469,902 Members | 2,003 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,902 developers. It's quick & easy.

Problems using exif_thumbnail() to create thumbnail image

PHP 4.3.2 with --enable-exif

I have the following class:

Expand|Select|Wrap|Line Numbers
  1. <?php
  3. class ThumbGenerator extends MethodGeneratorForActionPerformer {
  5. function ThumbGenerator() {      // CONSTRUCTOR
  7. }
  9. /**
  10. * This method can only be used if you are using PHP version 4.3+
  11. and if you have TIFF or JPEG image
  12. *
  13. * @access private
  14. */
  15. function generateTIFFJPEGThumb() {                            //
  17. global $section, $thumbLocationPath;
  18. /*------------------------------------------------------------------------------------------------------------------------------------------
  19. Because of the different methodologies of each method, the
  20. constructor must be called, thus, the class object
  21. must be initiated.  If "$this" does not exist, trigger an
  22. error
  23. -------------------------------------------------------------------------------------------------------------------------------------------*/
  24. if (!$this || !is_object($this)) trigger_error('You must first
  25. instantiate a ThumbGenerator object to use this method',
  26. E_USER_ERROR);
  30. if ($this->isSuccessful) {
  31. $thumbStreamObj = exif_thumbnail($this->locationPath . '/' .
  32. $this->fileName, $width, $height, $mimeTypeInt);
  33. print_r('<P>thumbStreamObj: '); print_r($thumbStreamObj);
  34. if (!$thumbStreamObj) {
  35. $this->isSuccessful = false;
  36. $this->setErrorArray(array('section' => 'Could not extract
  37. embedded thumbnail contents from "' . $this->locationPath . '/' .
  38. $this->fileName . '"'));
  39. }
  40. }
  42. }
  44. }
  46. ?>
The class is being used to literally generate a thumbnail from an
existing image. I read in the PHP manual (see
http://us3.php.net/manual/en/functio...-thumbnail.php ) that
exif_thumbnail() only extracts embedded thumbnail information from a
image. In knowing that I've simplified my method to only handle TIFF
or JPEG images (this is done in the class constructor - sorting out
what image type you got).

At this point, however, I am receiving nothing into the
$thumbStreamObj binary stream string variable; it's "empty" (false):

Expand|Select|Wrap|Line Numbers
  1. $thumbstreamObj = exif_thumbnail($this->locationPath . '/' .
  2. $this->fileName, $width, $height, $mimeTypeInt);
I checked the values of $this->fileName and $this->locationPath and
both contain the correct values to be able to locate the image in the
system for the function to extract the embedded thumbnail information
reportedly found in TIFF and JPEG images.

Has anyone had any luck using this to create a thumbnail? I could use
some more experted advice than I would think to find in the manual
notes, which I am certain I'll find among you gurus here.

Jul 17 '05 #1
1 3297
so*****@erols.com (Phil Powell) wrote in message news:<1c**************************@posting.google. com>...
PHP 4.3.2 with --enable-exif

I have the following class:


class ThumbGenerator extends MethodGeneratorForActionPerformer {


Not sure about your code. But, sometimes ago Mike Bradley, one of
the regular contributor of this group has written a thumbnail script
named gzImage.php But, unfortunately, now his site <gZenTools.com> is
down. I'm having a copy of his script Version 2.4 (not sure, if he has
released any new version). The script was much appreciated by the
regulars of this group. If you need that, you may contact me at my
email found at my sig-block.

| Just another PHP saint |
Email: rrjanbiah-at-Y!com
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Greg Scharlemann | last post: by
4 posts views Thread by WStoreyII | last post: by
4 posts views Thread by John Swan | last post: by
3 posts views Thread by KimberlyM | last post: by
3 posts views Thread by Danny Ni | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.