« Feed2JS - RSS to Javascript code from Maricopa | Main | Syndicated bookmarks in Mozilla 1.0 »
November 11, 2004
Changes to my photo album code
I finally installed my PHP photo album on minnesota with the latest version of PHP which has GD rolled into it. When I finally got the JPEG library compiled into it though, I was getting images with only 256 colours.
I amended the code as follows and now have better image quality than I do with the app running on my iBook with a more aged PHP:
#$img_src=imagecreatefromjpeg('yoursource.jpg');
#$img_dst=imagecreatetruecolor(20,20);
#imagecopyresampled($img_dst, $img_src, 0, 0, 0, 0, 20, 20, 20, 20);
#imagejpeg($img_dst, $g_dstfile, 100);
#imagedestroy($img_dst);
$original = imagecreatefromjpeg($url);
$new = imagecreatetruecolor($width, $height);
#$new = imagecreate($width, $height);
imagecopyresampled($new, $original, 0,0,0,0, $width, $height, $size[0], $size[1]);
#imagecopyresized($new, $original, 0,0,0,0, $width, $height, $size[0], $size[1]);
Header("Content-type: image/jpeg");
if(is_null($gamma_off)){ imagegammacorrect($new, 1.0, 1.6); }
imagejpeg($new, '', 100);
#imagejpeg($new, '', 90);
imagedestroy($new);
imagedestroy($original);
< http://minnesota.ncl.ac.uk/photo_collections.php >
I've also added CC license, DC and FOAF metadata to the scripts. See copyright.rdf.
Tags: PHP
Posted by pj at November 11, 2004 11:40 AM