[ PHPXref.com ] [ Generated: Sun Jul 20 19:44:41 2008 ] [ PHP JPEG Metadata 1.11 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> get_JFXX_thumb.php (source)

   1  <?php
   2  
   3  /******************************************************************************

   4  *

   5  * Filename:     get_JFXX_thumb.php

   6  *

   7  * Description:  This script extracts a JFXX (JPEG File Interchange Format

   8  *               Extension) thumbnail from within a JPEG file and allows it

   9  *               to be displayed

  10  *

  11  * Usage:        get_JFXX_thumb?filename=<filename>

  12  *

  13  * Author:       Evan Hunter

  14  *

  15  * Date:         23/7/2004

  16  *

  17  * Project:      PHP JPEG Metadata Toolkit

  18  *

  19  * Revision:     1.00

  20  *

  21  * URL:          http://electronics.ozhiker.com

  22  *

  23  * Copyright:    Copyright Evan Hunter 2004

  24  *

  25  * License:      This file is part of the PHP JPEG Metadata Toolkit.

  26  *

  27  *               The PHP JPEG Metadata Toolkit is free software; you can

  28  *               redistribute it and/or modify it under the terms of the

  29  *               GNU General Public License as published by the Free Software

  30  *               Foundation; either version 2 of the License, or (at your

  31  *               option) any later version.

  32  *

  33  *               The PHP JPEG Metadata Toolkit is distributed in the hope

  34  *               that it will be useful, but WITHOUT ANY WARRANTY; without

  35  *               even the implied warranty of MERCHANTABILITY or FITNESS

  36  *               FOR A PARTICULAR PURPOSE.  See the GNU General Public License

  37  *               for more details.

  38  *

  39  *               You should have received a copy of the GNU General Public

  40  *               License along with the PHP JPEG Metadata Toolkit; if not,

  41  *               write to the Free Software Foundation, Inc., 59 Temple

  42  *               Place, Suite 330, Boston, MA  02111-1307  USA

  43  *

  44  *               If you require a different license for commercial or other

  45  *               purposes, please contact the author: evan@ozhiker.com

  46  *

  47  ******************************************************************************/
  48  
  49  
  50          // Ensure that nothing can write to the standard io, before we get the header out

  51          ob_start( );
  52  
  53  
  54          include  'JPEG.php';
  55          include  'JFIF.php';
  56  
  57  
  58          // retrieve the filename from the URL parameters

  59          
  60          $filename = $GLOBALS['HTTP_GET_VARS']['filename'];
  61  
  62          // Retrieve the JPEG header Data

  63          
  64          $jpeg_header_data = get_jpeg_header_data( $filename );
  65  
  66          // Retrieve any JFXX data in the file

  67  
  68          $JFXX_array = get_JFXX( $jpeg_header_data );
  69  
  70          // Check if JFXX data was retrieved

  71  
  72          if ( $JFXX_array === FALSE )
  73          {
  74                  // No JFXX data could be retrieved - abort

  75                  ob_end_clean ( );
  76                  echo "<p>JFXX Data could not be retrieved</p>\n";
  77                  return;
  78          }
  79  
  80          // Check the JFXX extension code which indicates what format

  81          // the thumbnail is encoded with

  82          
  83          if ( $JFXX_array['Extension_Code'] == 0x10 ) // JPEG Encoding
  84          {
  85                  // JPEG Encoding - Output JPEG Data

  86                  ob_end_clean ( );
  87                  header("Content-type: image/jpeg");
  88                  print $JFXX_array['ThumbData'];
  89                  return;
  90          }
  91          else if ( $JFXX_array['Extension_Code'] == 0x11 ) // One Byte Per Pixel Encoding
  92          {
  93                  // TODO: Implement decoding of One Byte Per Pixel encoded JFXX Thumbnail

  94                  return;
  95          }
  96          else if ( $JFXX_array['Extension_Code'] == 0x13 ) // Three Bytes Per Pixel Encoding
  97          {
  98                  // TODO: Implement decoding of Three Bytes Per Pixel encoded JFXX Thumbnail

  99                  return;
 100          }
 101          else
 102          {
 103                  // Invalid Extension Value - abort

 104                  return;
 105          }
 106  
 107  
 108  
 109  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]