For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > November 2004 > ImageTransform messing up pictures









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author ImageTransform messing up pictures
Trevan

2004-11-29, 4:04 pm

I am trying to use ImageTransform to create thumbnails for a gallery
that I am building. I am using the GD driver (PHP has gd installed with
it). But when I resize the image, the resulting image's color is
destroyed. It seems to turn it into black and white. I have followed
the examples that was included with the GD driver, but can't seem to
figure out what I am doing wrong. Here is my code. ($art is a
dataobject that stores the filename in a mysql table). Is there a
setting that I need to set? Or should I use a different driver? (this
occurs on my test and production server). The filetypes are jpg.

$thumbnail = Image_Transform::factory('GD');
$thumbnail->load(BASEDIR.$art->picture);
$thumbnail->keepSettingsOnSave(true);
$thumbnail->scaleMaxlength('150');
$path = pathinfo($art->picture);
$thumbnail_file = '/images/gallery/thumbnails/'.$path['basename'];
$thumbnail->save(BASEDIR.$thumbnail_file,'',200);
$art->thumbnail = $thumbnail_file;


Trevan
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com