!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:     TrimCommand.php (3.58 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace Intervention\Image\Imagick\Commands;

use 
Intervention\Image\Commands\AbstractCommand;
use 
Intervention\Image\Imagick\Color;

class 
TrimCommand extends AbstractCommand
{
    
/**
     * Trims away parts of an image
     *
     * @param  \Intervention\Image\Image $image
     * @return boolean
     */
    
public function execute($image)
    {
        
$base $this->argument(0)->type('string')->value();
        
$away $this->argument(1)->value();
        
$tolerance $this->argument(2)->type('numeric')->value(0);
        
$feather $this->argument(3)->type('numeric')->value(0);

        
$width $image->getWidth();
        
$height $image->getHeight();

        
$checkTransparency false;

        
// define borders to trim away
        
if (is_null($away)) {
            
$away = ['top''right''bottom''left'];
        } elseif (
is_string($away)) {
            
$away = [$away];
        }

        
// lower border names
        
foreach ($away as $key => $value) {
            
$away[$key] = strtolower($value);
        }

        
// define base color position
        
switch (strtolower($base)) {
            case 
'transparent':
            case 
'trans':
                
$checkTransparency true;
                
$base_x 0;
                
$base_y 0;
                break;

            case 
'bottom-right':
            case 
'right-bottom':
                
$base_x $width 1;
                
$base_y $height 1;
                break;

            default:
            case 
'top-left':
            case 
'left-top':
                
$base_x 0;
                
$base_y 0;
                break;
        }

        
// pick base color
        
if ($checkTransparency) {
            
$base_color = new Color// color will only be used to compare alpha channel
        
} else {
            
$base_color $image->pickColor($base_x$base_y'object');
        }

        
// trim on clone to get only coordinates
        
$trimed = clone $image->getCore();

        
// add border to trim specific color
        
$trimed->borderImage($base_color->getPixel(), 11);

        
// trim image
        
$trimed->trimImage(65850 100 $tolerance);

        
// get coordinates of trim
        
$imagePage $trimed->getImagePage();
        list(
$crop_x$crop_y) = [$imagePage['x']-1$imagePage['y']-1];
        
// $trimed->setImagePage(0, 0, 0, 0);
        
list($crop_width$crop_height) = [$trimed->width$trimed->height];

        
// adjust settings if right should not be trimed
        
if ( ! in_array('right'$away)) {
            
$crop_width $crop_width + ($width - ($width $crop_x));
        }

        
// adjust settings if bottom should not be trimed
        
if ( ! in_array('bottom'$away)) {
            
$crop_height $crop_height + ($height - ($height $crop_y));
        }

        
// adjust settings if left should not be trimed
        
if ( ! in_array('left'$away)) {
            
$crop_width $crop_width $crop_x;
            
$crop_x 0;
        }

        
// adjust settings if top should not be trimed
        
if ( ! in_array('top'$away)) {
            
$crop_height $crop_height $crop_y;
            
$crop_y 0;
        }

        
// add feather
        
$crop_width min($width, ($crop_width $feather 2));
        
$crop_height min($height, ($crop_height $feather 2));
        
$crop_x max(0, ($crop_x $feather));
        
$crop_y max(0, ($crop_y $feather));

        
// finally crop based on page
        
$image->getCore()->cropImage($crop_width$crop_height$crop_x$crop_y);
        
$image->getCore()->setImagePage(0,0,0,0);

        
$trimed->destroy();

        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.0177 ]--