Jump to content

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 ......?

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);

}

 

   

}

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);

}

 

   

 

}

 

This function should work the same on both ends. Are the versions of PHP different? What about the GD lib?

 

Chris

 

Server php version is 5.1.6, local is 5.2.0. GD lib is enabled and both having same version Ver. 2.0

  • 3 weeks later...

You can't really suggest anything for running out of memory, other than making more space. Running out of memory is basically where you can not add anything else to your website hoster.

 

Anyway I left it..........thanks for help.

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.