Reply to Re: [PHP] Check if an url is a jpg image

Your name:

Reply:


Posted by Richard Davey on 10/12/05 13:24

Hi Tommy,

Wednesday, October 12, 2005, 10:48:55 AM, you wrote:

> Is it possible to check if an url is a jpg image from php?

#1 Quick and unreliable: Check if there is a .jpg or .jpeg as the final
characters of the URL string.

#2 Bit more complex, very expensive: fopen() the URL, download the
content to a temporary location, inspect it with native php functions
like getimagesize. If your PHP config allows, you can probably perform
a getimagesize directly on the URL, but I've not tried this.

#3 Trickier, less expensive than #2, but balls-on accurate: fopen()
the URL (after suitable validation) and grab the header (the first few
KB). JPEG files are easily identified, but come in a variety of
flavours.

http://www.codeproject.com/bitmap/iptc.asp

Cheers,

Rich
--
Zend Certified Engineer
http://www.launchcode.co.uk

[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

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