Reply to Re: Thumbnail orientation

Your name:

Reply:


Posted by Milagro on 05/03/07 15:19

On 2007-05-03 10:45:10 -0400, Mattia Gentilini
<Mattia.Gentilini_REMOVE_@_REMOVE_CNAF.INFN.IT> said:

> Milagro ha scritto:
>> I'm using the code below to create thumbnails from photos. The code
>> works fine and thumbnails are created. However, thumbnails of vertical
>> photos are oriented as horizontal photos.
> It seems you have to check the EXIF orientation. EXIF is a metadata
> section for JPEG, which most cameras set when they take a photo.
> You could access the EXIF data using the exif_read_data() function (see
> the doc for info about input parameters) which will return you an array.
> After that, you could deterine if the image has to be rotated in this
> way ($exif is the array returned by exif_read_data() ):
>
> $o = $exif["IFD0"]["Orientation"];
> $rotate = 0;
> $flip = false;
> switch($o) {
> case 1:
> $rotate = 0;
> $flip = false;
> break;
>
> case 2:
> $rotate = 0;
> $flip = true;
> break;
>
> case 3:
> $rotate = 180;
> $flip = false;
> break;
>
> case 4:
> $rotate = 180;
> $flip = true;
> break;
>
> case 5:
> $rotate = 90;
> $flip = true;
> break;
>
> case 6:
> $rotate = 90;
> $flip = false;
> break;
>
> case 7:
> $rotate = 270;
> $flip = true;
> break;
>
> case 8:
> $rotate = 270;
> $flip = false;
> break;
> }
>
> Now, $rotate indicates how many degrees the image should be rotated
> (clockwise). Then, if $flip is true , you should also flip horizontally
> the image (normally this is not the case for digital camera photos)


Thank you very much, this is exactly what I was looking for.
Ciao!

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация