![]() |
Image filetype conversion
ok, I am working on a project where the client wants to be able to upload images to his site. The problem: the files are inconsistent. They are different sizes, have no set naming structure, and are different formats - mostly jpeg, tiff, and png.
Resizing and renaming is easy enough through php, but the filetype is the problem, have any idea if/how I can convert the image from tiff or png to jpg using php? Thanks, Jason Corradino |
As far as I know, JPEG and TIFF coding don't come close to looking like eachother so I think that's a no-go. The smartest thing for you to do, is just simply sort them by type or let the customer upload regular images, since TIFF usually is way to big (print size, 300DPI).
One way you can try, is to find some online converter, but I guess that'll cost money. Sorry to burst your bubble, but I don't reckon it's possible. Perhaps the other Guru's might now something. |
Quote:
|
Indeed. You can download simple converters. Just make a small read-me for the client and he'll be able to all the work himself. On the other hand, if you're in for the money, just tell him to send you the pictures and you'll do it yourself. :-D
|
You can use PHP's GD functions to load in the image (gif, png, tiff, whatever) and save it out in jpg format with only a couple of lines of code. Unless I'm missing the actual problem here, it seems a simple enough solution.
|
TIFF can be a container format for images and one of the encoding types of TIFF is JPEG aswel as large 300+ DPI vector images for print etc.
Anyway, Salathe has one solution although i dunno how it would fair if a TIFF was used, as there isn't a TIFF function in PHP's GD API. You could also use imagemagick, if you have a *nix box with it installed, you can do this: PHP Code:
You can even do the conversion and resize all in one: PHP Code:
|
I am not known with imagemagick since it has been disabled on my server. ;) Good solution non the less. I advise you to try those two.
|
| All times are GMT. The time now is 01:29 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0