I have the following class:
Expand|Select|Wrap|Line Numbers
- <?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 . '"'));
- }
- }
- }
- }
- ?>
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):
Expand|Select|Wrap|Line Numbers
- $thumbstreamObj = exif_thumbnail($this->locationPath . '/' .
- $this->fileName, $width, $height, $mimeTypeInt);
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