NYCPHP Meetup

NYPHP.org

[nycphp-talk] exif_thumbnail

Ken Robinson kenrbnsn at rbnsn.com
Tue Oct 31 14:26:46 EST 2006


At 02:02 PM 10/31/2006, Bill Kamm wrote:
>Does this help?
>
>http://www.php.net/ob_start
>
>"This function will turn output buffering on. While output buffering is
>active no output is sent from the script (other than headers), instead
>the output is stored in an internal buffer."
>
>Bill
>
>David Krings wrote:
>
> >Hi,
> >
> >    I want to use exif_thumbnail to extract the thumbnail of an image
> >and then have it displayed within a page. The page will have content
> >before and after the thumbnail, and the thumbnail may be present or not.
> >In order to have it show correctly, all manuals state to send the
> >content setting using header(). Since this is supposed to be embedded in
> >other content, I can't send the header (already started output).

What you want to do is use the "<img>'" tag in your script. The "src" 
attribute should point to a script that will send the image back.

Quick example (no error checking done...)
Main script
<?php
   <img src="tn.php?f=image.jpg">
?>

tn.php:
<?php
    $image = exif_thumbnail($_GET['f'], $width, $height, $type);
    header('Content-type: ' .image_type_to_mime_type($type));
    echo $image;
?>

Ken



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20061031/46398e74/attachment.html>


More information about the talk mailing list