PHP 4.3.2 with --enable-exif
I have the following class:
<?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/function.exif-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):
$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