Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php function resizeImage($resourceType,$image_width,$image_height,$resizeWidth,$resizeH..
Decoded Output download
<?php
function resizeImage($resourceType,$image_width,$image_height,$resizeWidth,$resizeHeight) {
// $resizeWidth = 100;
// $resizeHeight = 100;
$imageLayer = imagecreatetruecolor($resizeWidth,$resizeHeight);
imagecopyresampled($imageLayer,$resourceType,0,0,0,0,$resizeWidth,$resizeHeight, $image_width,$image_height);
return $imageLayer;
}
}
if(isset($_POST["form_submit"])) {
$imageProcess = 0;
if(is_array($_FILES)) {
// $new_width = $_POST['new_width'];
// $new_height = $_POST['new_height'];
$fileName = $_FILES['upload_image']['tmp_name'];
$sourceProperties = getimagesize($fileName);
$resizeFileName = time();
$uploadPath = "./uploads/";
$fileExt = pathinfo($_FILES['upload_image']['name'], PATHINFO_EXTENSION);
$uploadImageType = $sourceProperties[2];
$sourceImageWidth = $sourceProperties[0];
$sourceImageHeight = $sourceProperties[1];
switch ($uploadImageType) {
case IMAGETYPE_JPEG:
$resourceType = imagecreatefromjpeg($fileName);
$imageLayer = resizeImage($resourceType,$sourceImageWidth,$sourceImageHeight,$new_width,$new_height);
imagejpeg($imageLayer,$uploadPath."192x192".$resizeFileName.'.'. $fileExt);
break;
case IMAGETYPE_GIF:
$resourceType = imagecreatefromgif($fileName);
$imageLayer = resizeImage($resourceType,$sourceImageWidth,$sourceImageHeight,$new_width,$new_height);
imagegif($imageLayer,$uploadPath."thump_".$resizeFileName.'.'. $fileExt);
break;
case IMAGETYPE_PNG:
$resourceType = imagecreatefrompng($fileName);
$imageLayer = resizeImage($resourceType,$sourceImageWidth,$sourceImageHeight,$new_width,$new_height);
imagepng($imageLayer,$uploadPath."thump_".$resizeFileName.'.'. $fileExt);
break;
default:
$imageProcess = 0;
break;
}
move_uploaded_file($fileName, $uploadPath. $resizeFileName. ".". $fileExt);
$imageProcess = 1;
if($imageProcess == 1){
?>
Did this file decode correctly?
Original Code
<?php
function resizeImage($resourceType,$image_width,$image_height,$resizeWidth,$resizeHeight) {
// $resizeWidth = 100;
// $resizeHeight = 100;
$imageLayer = imagecreatetruecolor($resizeWidth,$resizeHeight);
imagecopyresampled($imageLayer,$resourceType,0,0,0,0,$resizeWidth,$resizeHeight, $image_width,$image_height);
return $imageLayer;
}
}
if(isset($_POST["form_submit"])) {
$imageProcess = 0;
if(is_array($_FILES)) {
// $new_width = $_POST['new_width'];
// $new_height = $_POST['new_height'];
$fileName = $_FILES['upload_image']['tmp_name'];
$sourceProperties = getimagesize($fileName);
$resizeFileName = time();
$uploadPath = "./uploads/";
$fileExt = pathinfo($_FILES['upload_image']['name'], PATHINFO_EXTENSION);
$uploadImageType = $sourceProperties[2];
$sourceImageWidth = $sourceProperties[0];
$sourceImageHeight = $sourceProperties[1];
switch ($uploadImageType) {
case IMAGETYPE_JPEG:
$resourceType = imagecreatefromjpeg($fileName);
$imageLayer = resizeImage($resourceType,$sourceImageWidth,$sourceImageHeight,$new_width,$new_height);
imagejpeg($imageLayer,$uploadPath."192x192".$resizeFileName.'.'. $fileExt);
break;
case IMAGETYPE_GIF:
$resourceType = imagecreatefromgif($fileName);
$imageLayer = resizeImage($resourceType,$sourceImageWidth,$sourceImageHeight,$new_width,$new_height);
imagegif($imageLayer,$uploadPath."thump_".$resizeFileName.'.'. $fileExt);
break;
case IMAGETYPE_PNG:
$resourceType = imagecreatefrompng($fileName);
$imageLayer = resizeImage($resourceType,$sourceImageWidth,$sourceImageHeight,$new_width,$new_height);
imagepng($imageLayer,$uploadPath."thump_".$resizeFileName.'.'. $fileExt);
break;
default:
$imageProcess = 0;
break;
}
move_uploaded_file($fileName, $uploadPath. $resizeFileName. ".". $fileExt);
$imageProcess = 1;
if($imageProcess == 1){
?>
Function Calls
None |
Stats
MD5 | 3416de260de170c3ffc2fab7da90cef9 |
Eval Count | 0 |
Decode Time | 79 ms |