Re: Images - Converting TIFF Format?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I searched through my server's system (I'm not running it, it's my ISP) and 
finally found that TIFF isn't compiled into GD. I can get them to do it, but 
I need to know what functions to use! Are they under a different file type? 
I'm pretty sure I searched through thoroughly for the function. Did I miss 
something?
 Thanks for all your help!

 On 4/19/05, Tom Rogers <trogers@xxxxxxxxxx> wrote: 
> 
> Hi,
> 
> Wednesday, April 20, 2005, 12:39:54 AM, you wrote:
> TDJ> Is there a quick way to convert a TIFF format picture to a GIF 
> quickly? I
> TDJ> can only find support for GIFs in PHP, but maybe I'm missing 
> something. I
> TDJ> have a client running a photography business, and I have designed an 
> image
> TDJ> watermark and resizing engine, and a server to check the request, 
> serve the
> TDJ> file, and then delete it. I mainly made this to help him run the site
> TDJ> himself, since he isn't very good with Photoshop, and can't watermark 
> the
> TDJ> images (I shouldn't say that...he probably could, but not very 
> fast....but
> TDJ> anyway...).
> TDJ> This is all working fine and dandy, but the system will only accept 
> GIF
> TDJ> format. His images are all raw scans in TIFF format. This means that 
> he has
> TDJ> to open the image in Photoshop, resize it, and convert it to a GIF. I 
> think
> TDJ> he can do this himself, but I'd like to make it even simpler, which 
> is why
> TDJ> I'm writing.
> TDJ> I need a quick way, preferably in PHP, but it doesn't have to be, to
> TDJ> convert large batches of TIFF format images to GIF. Does anyone know 
> of a
> TDJ> way to do this?
> TDJ> Thanks for reading, and for your responses in advance...
> 
> I use netpbm for conversion to png from tiffs and windows bitmaps like 
> this:
> 
> //$tempname from fileupload tmpname
> //$file from fileupload name
> $jobpath = '/wherever/you/want/files/stored';
> if($im = getimagesize($tempname)){
> if($im[0] > 0){
> //cleanup filename
> $file = ereg_replace("'","",$file);
> $file = ereg_replace("%20","_",$file);
> $file = ereg_replace(" ","_",$file);
> $ext = @substr($file, (@strrpos($file, ".") ? @strrpos($file, ".") + 1 : 
> @strlen($file)), @strlen($file));
> $fname = basename($file,$ext);
> switch(intval($im[2])){
> case 7:
> case 8:
> //force a tif extension for netpbm
> $tfilename = $jobpath.'/'.$fname.'tif';
> move_uploaded_file($tempname, $tfilename);
> $file = $fname.'png';
> $filename = $jobpath.'/'.$file;
> shell_exec ("/path/to/netpbm/bin/tifftopnm -quiet $tfilename | 
> /path/to/netpbm/bin/pnmtopng > $filename");
> break;
> case 6:
> //force a bmp extension for netpbm
> $tfilename = $jobpath.'/'.$fname.'bmp';
> move_uploaded_file($tempname, $tfilename);
> $file = $fname.'png';
> $filename = $jobpath.'/'.$file;
> shell_exec ("/path/to/netpbm/bin/bmptoppm -quiet $tfilename | 
> /path/to/netpbm/bin/pnmtopng > $filename");
> break;
> default:
> $filename = $jobpath.'/'.$file;
> move_uploaded_file($tempname, $filename);
> break;
> }
> }
> }
> 
> --
> regards,
> Tom
> 
> 


-- 
The Disguised Jedi
disguised.jedi@xxxxxxxxx

Now you have my $0.02. Or .01 Pounds, .014 Euros, or $0.025 CAN. I'm 
world-wide BABY!
PHP rocks!
"Knowledge is Power. Power Corrupts. Go to school, become evil"

Disclaimer: Any disclaimer attached to this message may be ignored. However, 
I must say that the ENTIRE contents of this message are subject to other's 
criticism, corrections, and speculations.

This message is Certified Virus Free

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux