Problems using exif_thumbnail() to create thumbnail image

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Phil Powell

    Problems using exif_thumbnail() to create thumbnail image

    PHP 4.3.2 with --enable-exif

    I have the following class:

    Code:
    <?php
    
    class ThumbGenerator extends MethodGeneratorForActionPerformer {
    
    function ThumbGenerator() {      // CONSTRUCTOR
    // DO ALL KINDS OF STUFF HERE
    }
    
    /**
    * This method can only be used if you are using PHP version 4.3+
    and if you have TIFF or JPEG image
    *
    * @access private
    */
    function generateTIFFJPEGThumb() {                            //
    VOID METHOD
    global $section, $thumbLocationPath;
    /*------------------------------------------------------------------------------------------------------------------------------------------
    Because of the different methodologies of each method, the
    constructor must be called, thus, the class object
    must be initiated.  If "$this" does not exist, trigger an
    error
    -------------------------------------------------------------------------------------------------------------------------------------------*/
    if (!$this || !is_object($this)) trigger_error('You must first
    instantiate a ThumbGenerator object to use this method',
    E_USER_ERROR);
    
    // STREAM FILE EMBEDDED THUMBNAIL CONTENTS INTO BINARY STRING
    VARIABLE
    if ($this->isSuccessful) {
    $thumbStreamObj = exif_thumbnail($this->locationPath . '/' .
    $this->fileName, $width, $height, $mimeTypeInt);
    print_r('<P>thumbStreamObj: '); print_r($thumbStreamObj);
    if (!$thumbStreamObj) {
    $this->isSuccessful = false;
    $this->setErrorArray(array('section' => 'Could not extract
    embedded thumbnail contents from "' . $this->locationPath . '/' .
    $this->fileName . '"'));
    }
    }
    
    }
    
    }
    
    ?>
    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
    TIFF or JPEG
    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):

    Code:
    $thumbstreamObj = exif_thumbnail($this->locationPath . '/' .
    $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.

    Thanx
    Phil
  • R. Rajesh Jeba Anbiah

    #2
    Re: Problems using exif_thumbnail( ) to create thumbnail image

    soazine@erols.c om (Phil Powell) wrote in message news:<1cdca2a7. 0405051217.144d ab02@posting.go ogle.com>...[color=blue]
    > PHP 4.3.2 with --enable-exif
    >
    > I have the following class:
    >
    > [CODE]
    > <?php
    >
    > class ThumbGenerator extends MethodGenerator ForActionPerfor mer {[/color]

    <snip>

    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.co m> 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

    Comment

    Working...