Jump to content

PHP Image Resize issue for large resolution JPEGs


avvllvva

Recommended Posts

I have tried to resize 3000*3000 resolution images using normal functions in php. In local server it was resized perfectly but in online server it was not working, at there maxium resized resolution was 1600*1500. Could anybody help me to fix this ......?

Link to comment
Share on other sites

function PL_CJimageresize($filepath,$filename,$id,$uploaddir,$wide,$long,$table,$field,$extension){

 

list($width, $height) = getimagesize($filepath);

 

if($width>$wide)

$new_width = $wide;

else

$new_width = $width;

 

if($height>$long)

$new_height = $long;

else

$new_height = $height;

 

 

 

// ______________________________Resample________________________________________________

$image_p = imagecreatetruecolor($new_width, $new_height);

if($extension=="jpeg" || $extension=="jpg" || $extension=="JPG" || $extension=="JPEG" ){

$image = imagecreatefromjpeg($filepath);

}

else if($extension=="gif"){

$image = imagecreatefromgif($filepath);

}

else if($extension=="png"){

$image = imagecreatefrompng($filepath);

}

imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);

 

 

//_______________________________Output destination file_____________________________________

$newname =$uploaddir.$filename;

if($extension=="jpeg" || $extension=="jpg"){

imagejpeg($image_p, $newname);

}

else if($extension=="gif"){

imagegif($image_p, $newname);

}

else if($extension=="png" || $extension=="PNG"){

imagepng($image_p, $newname);

}

 

   

}

Link to comment
Share on other sites

I have tried to resize 3000*3000 resolution images using normal functions in php. In local server it was resized perfectly but in online server it was not working, at there maxium resized resolution was 1600*1500. Could anybody help me to fix this ......?

 

function PL_CJimageresize($filepath,$filename,$id,$uploaddir,$wide,$long,$table,$field,$extension){

 

list($width, $height) = getimagesize($filepath);

 

if($width>$wide)

$new_width = $wide;

else

$new_width = $width;

 

if($height>$long)

$new_height = $long;

else

$new_height = $height;

 

 

 

// ______________________________Resample________________________________________________

$image_p = imagecreatetruecolor($new_width, $new_height);

if($extension=="jpeg" || $extension=="jpg"  ){

$image = imagecreatefromjpeg($filepath);

}

else if($extension=="gif"){

$image = imagecreatefromgif($filepath);

}

else if($extension=="png"){

$image = imagecreatefrompng($filepath);

}

imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);

 

 

//_______________________________Output destination file_____________________________________

$newname =$uploaddir.$filename;

if($extension=="jpeg" || $extension=="jpg"){

imagejpeg($image_p, $newname);

}

else if($extension=="gif"){

imagegif($image_p, $newname);

}

else if($extension=="png" || $extension=="PNG"){

imagepng($image_p, $newname);

}

 

   

 

}

 

Link to comment
Share on other sites

  • 3 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.