Author: Tobias Schlitt
Date: 2006-01-15 15:16:22 +0100 (Sun, 15 Jan 2006)
New Revision: 1858
Log:
- Added runable example.
- Syncronized with inline doc example.
Added:
packages/ImageAnalysis/trunk/docs/example.php
packages/ImageAnalysis/trunk/docs/toby.jpg
Modified:
packages/ImageAnalysis/trunk/src/analyzer.php
Added: packages/ImageAnalysis/trunk/docs/example.php
===================================================================
--- packages/ImageAnalysis/trunk/docs/example.php 2006-01-15 14:06:07 UTC
(rev 1857)
+++ packages/ImageAnalysis/trunk/docs/example.php 2006-01-15 14:16:22 UTC
(rev 1858)
@@ -0,0 +1,40 @@
+<?php
+
+require_once 'Base/trunk/src/base.php';
+
+/**
+ * Autoload ezc classes
+ *
+ * @param string $class_name
+ */
+function __autoload( $class_name )
+{
+ if ( ezcBase::autoload( $class_name ) )
+ {
+ return;
+ }
+ if ( strpos( $class_name, '_' ) !== false )
+ {
+ $file = str_replace( '_', '/', $class_name ) . '.php';
+ require_once( $file );
+ }
+}
+
+// Analyzation of the MIME type is done during creation.
+$image = new ezcImageAnalyzer( dirname( __FILE__ ).'/toby.jpg' );
+
+if ( $image->mime == 'image/tiff' || $image->mime == 'image/jpeg' )
+{
+ // Analyzation of further image data is done during access of the data
+ echo 'Photo taken on '.date( 'Y/m/d, H:i', $image->data->date ).".\n";
+}
+elseif ( $mime !== false )
+{
+ echo "Format was detected as {$mime}.\n";
+}
+else
+{
+ echo "Unknown photo format.\n";
+}
+
+?>
Property changes on: packages/ImageAnalysis/trunk/docs/example.php
___________________________________________________________________
Name: svn:eol-style
+ native
Added: packages/ImageAnalysis/trunk/docs/toby.jpg
===================================================================
(Binary files differ)
Property changes on: packages/ImageAnalysis/trunk/docs/toby.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: packages/ImageAnalysis/trunk/src/analyzer.php
===================================================================
--- packages/ImageAnalysis/trunk/src/analyzer.php 2006-01-15 14:06:07 UTC
(rev 1857)
+++ packages/ImageAnalysis/trunk/src/analyzer.php 2006-01-15 14:16:22 UTC
(rev 1858)
@@ -34,10 +34,10 @@
*
* A simple example.
* <code>
- * $image = new ezcImageAnalyzer( '/var/cache/images/toby.jpg' );
* // Analyzation of the MIME type is done during creation.
- * $mime = $image->mime;
- * if ( $mime == 'image/tiff' || $mime == 'image/jpeg' )
+ * $image = new ezcImageAnalyzer( dirname( __FILE__ ).'/toby.jpg' );
+ *
+ * if ( $image->mime == 'image/tiff' || $image->mime == 'image/jpeg' )
* {
* // Analyzation of further image data is done during access of the data
* echo 'Photo taken on '.date( 'Y/m/d, H:i', $image->data->date ).".\n";
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components