Ok, I just upgraded to apache 2.0 and php 4.3 and now I'm getting screwed on imagecreatejpg. This is a basic script that took a file and resized it, no problem. Well now it's getting resized and moved to 4 (maybe 8) colors. That's no good. I looked through the documentation and it looks like the only help i can find says use createimagetruecolor() but when I do that, it says it's not an available function. Maybe the docs haven't caught up with 4.3 yet?
Anyway, I've installed the latest version of GD (2.0.9). my config script is "./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-gd=/usr/local --with-openssl=/usr/local/ssl --enable-calendar --with-exif " and everything compiles without error.
but as a result I get http://www.marigotcollection.com/products/resize.php?img=images/01000.jpg&picsize=100
But the exact same script gives me the correct results here:
http://68.63.40.59/marigot/products/resize.php?img=images/01000.jpg&picsize=100
If anyone wants to check the compile stuff try http://68.63.40.59/ and http://www.marigotcollection.com/test.php
The only part that I wasn't able to get done was "--with-jpeg-dir=/usr/local" Everytime I tried it with that I got this lovely error "onfigure: error: Unable to find gd.h anywhere under /usr/local --with-jpeg-dir=/usr/local/"
My original image I'm resizeing is http://www.marigotcollection.com/products/images/01000.jpg and my source code is ....
Header ("Content-type: image/jpeg");
if (isset($HTTP_GET_VARS[picsize]) && ($HTTP_GET_VARS[picsize]<= 800)){
$picsize = $HTTP_GET_VARS[picsize];
}
else {
$picsize =100;
}
$src_img = imagecreatefromjpeg($HTTP_GET_VARS[img]);
/* desired width of the thumbnail */
/* grabs the height and width */
$new_w = imagesx($src_img);
$new_h = imagesy($src_img);
/* calculates aspect ratio */
$aspect_ratio = $new_h / $new_w;
/* sets new size */
$new_w = $picsize;
$new_h = abs($new_w * $aspect_ratio);
/* creates new image of that size */
$dst_img = imagecreate($new_w,$new_h);
/* copies resized portion of original image into new image */
imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img));
/* return jpeg data back to browser */
imagejpeg($dst_img,"",100);
Thanks!