Mini Shell Moded By TiGER HeX
Home
||
Turbo Force
||
B-F Config_Cpanel
Current Path :
/
var
/
www
/
50mmla
/
includes
/
static
/
Linux midnightridazz 4.19.0-11-cloud-amd64 #1 SMP Debian 4.19.146-1 (2020-09-17) x86_64
Upload File :
New :
File
Dir
//var/www/50mmla/includes/static/gdimg.php
<?php class gd_img{ var $img_id; var $img_type; var $img_path; var $gd_error; var $new_id; var $quality = 100; function gd_img($filetype,$filepath,$from_string=false,$binary=""){ $this->img_type = $filetype; $this->img_path = $filepath; if($from_string){ $this->img_id = imagecreatefromstring(base64_decode($binary)); return $this->img_id; } if(preg_match("/jpeg/i",$filetype)){ $this->img_id = imagecreatefromjpeg($filepath); }elseif(preg_match("/gif/i",$filetype)){ $this->img_id = imagecreatefromgif($filepath); }elseif(preg_match("/png/i",$filetype)){ $this->img_id = imagecreatefrompng($filepath); }else{ $this->gd_error = "Unspupported file type. Must be jpg, gif, or png! ".$filetype; return false; } return $this->img_id; } function gd_scale_img($width,$height,$q){ if(!$this->img_id){ $this->gd_error = "No image handle"; return false; } $this->quality = $q; list($width_orig, $height_orig) = getimagesize($this->img_path); if ($width_orig < $height_orig) { $width = ($height / $height_orig) * $width_orig; } else { $height = ($width / $width_orig) * $height_orig; } // Resample $this->new_id = imagecreatetruecolor($width, $height); $result = imagecopyresampled($this->new_id, $this->img_id, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); if(!$result){ $this->gd_error = "Unable to copy resampled"; return false; } return $this->new_id; } function gd_crop_img($width,$height,$q){ if(!$this->img_id){ $this->gd_error = "No image handle"; return false; } $this->quality = $q; list($width_orig, $height_orig) = getimagesize($this->img_path); if($width_orig >= $height_orig){//width is greater so scale width $src_x = round(($width_orig-$height_orig)/2); $src_y = 0; $width_orig = $height_orig; }else{ $src_x = 0; $src_y = round(($height_orig-$width_orig)/2); $height_orig = $width_orig; } $this->new_id = imagecreatetruecolor($width, $height); $result = imagecopyresampled ($this->new_id,$this->img_id, 0,0,$src_x,$src_y, $width, $height, $width_orig, $height_orig); if(!$result){ $this->gd_error = "Unable to copy resampled"; return false; } return $this->new_id; } function gd_merge_ids($main_image,$child_image,$trans=50){ // get the width and height of each image. $main_image_width = imagesx($main_image); $main_image_height = imagesy($main_image); $child_width = imagesx($child_image); $child_height = imagesy($child_image); // this will be the position of the watermark $child_x = ($main_image_width - $child_width); $child_y = ($main_image_height - $child_height); // we want to put the watermark on top of the main image. $result = imagecopymerge($main_image, $child_image, $child_x, $child_y, 0, 0, $child_width, $child_height, $trans); if(!$result){ $this->gd_error = "Unable to merge"; return false; } return true; } function gd_create_img($id,$new_path){ if(preg_match("/jpeg/i",$this->img_type)){ $result = imagejpeg($id,$new_path,$this->quality); }elseif(preg_match("/gif/i",$this->img_type)){ $result = imagegif($id,$new_path,$this->quality); }elseif(preg_match("/png/i",$this->img_type)){ $result = imagepng($id,$new_path,$this->quality); } if(!$result){ $this->gd_error = "Unable to write image to disk."; return false; } return true; } } ?>