Kenny - you will find there are no native PHP handlers for TIFF.
If you're on a unix system you'll be able to use the imagemagick function 'convert' at a command line to do this. Something like this I developed for a client will work, you'll need to look up the passthru function in the PHP manual. This is an advanced technique, I'm not planning on discussing it in detail so you'll need to figure out how to get it to work on your own system. Please don't mail me saying 'it doesn't work'.
$binpath is the path to the system binaries, often /usr/bin. You're using the 'convert' command whlch you'll need to read up on in the imagemagick documentation, there's no space to put it here as it's very extensive in what image formats it can convert. PNG, PSD, GIF and other formats are also available.
In this case, $image_handle->username was just a user object which I used as part of the file name for the created file, as was $imgid. The file name ends in .jpeg in this case, convert decides what to convert to by the file extension of the created file name you give it.
passthru("$binpath/convert -quality 100 tiff:$filename $temppath".$image_handle->username.$imgid."jpeg",$imageraw);
$i=0;
while (! is_file("$imgdir/".$image_handle->username.$imgid."jpeg") && filesize("$temppath".$image_handle->username.$imgid."jpeg")==0) {
// Wait 0.2s increments for image creation to complete (if system is slow)
$i++;
if ($i >= 25) { // 5 seconds elapsed, still no file created
break;
}
clearstatcache();
usleep(200000);
}
You'll need to check to see if the created file is available after a few milliseconds as this is an out-of-band process, that is PHP can't know when the convert has finished in the case of a very large TIFF, So it polls the directory for the file becoming available. Clearstatcache is needed to purge the cached directory information, otherwise the loop will lock out assuming the file is never there. It breaks the loop at 5 seconds anyway if a hang has occurred.
HTH Neil
At 02:46 30/06/2004 +0000, you wrote:
To: Kenny <kenny@xxxxxxxxxxxxx>, php-db@xxxxxxxxxxxxx Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: Image Resize
Kenny wrote:
tiff is not good graficformat. The browsers aren´ t able to display this. Some browsers, f. e. IEHi All, Does anyone know if you can resize a tif image? I have created a photo gallery and the client want to be able to upload Jpeg and Tiff files, Unfortunately I have never worked with Tiff Here is my code for Jpg files, But tiff has me stumped
are not able to display the PNG-format always properly. The best you take only jpg. The snipplet
you send seams to work.
Regards,
======================================================== CaptionKit http://www.captionkit.com : Production tools for accessible subtitled internet media, transcripts and searchable video. Supports Real Player, Quicktime and Windows Media Player.
VideoChat with friends online, get Freshly Toasted every day at http://www.fresh-toast.net : NetMeeting solutions for a connected world.
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php