Jump to content

Imagemagick to GD


overflo

Recommended Posts

Hi

 

I'm in dire straits. Just spent ages putting together a dynamic site, uploaded and have found out that hosts have disabled exec functions due to security problems. I am so far very happy otherwise with hosts (just had a very bad experience with previous) the trouble is, as I also work and am primary carer for disabled son I don't have the time to learn the differences between Imagemagick and GD.

If anyone could start me off in the right direction by converting the following code (that gets the image, finds shortest edge and resizes so shortest edge is 300 the crops to 300x300) I will be eternally grateful.

 

Cheers

# $img  = "pathtoimage/image.jpg";
# $size = GetImageSize($img);
# $dim  = "300x300+0+0";
#  echo $size[0] . " " . $size[1];
#     // Wide Image
#     if($size[0] > $size[1]) {  
#         $thumbnail_height = 300;  
#         $thumbnail_width = (int)(300 * $size[0] / $size[1]);  
#     }  
#    
#     // Tall Image
#     else{
#          $thumbnail_height = (int)(300 * $size[1] / $size[0]);
#          $thumbnail_width = 300;
#     }
#        
# $mogrify = "pathtimagemagick/mogrify -geometry";
# $crop    = "pathtimagemagick/mogrify -gravity Center -crop";
# system("$mogrify $thumbnail_heightx$thumbnail_width $img", $exec_retval);
# system("$crop $dim $img", $exec_retval);

Link to comment
https://forums.phpfreaks.com/topic/104170-imagemagick-to-gd/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.