Forums / Developer / Tiff images / conversion to display in browser

Tiff images / conversion to display in browser

Author Message

Roman Mudrack

Wednesday 19 May 2004 7:42:42 am

hi,

referring to this : http://ez.no/community/forum/developer/tiff_images_media

i tried to implement a module which converts the tiff to a jpg.
but it quits with this error :
Fatal error: Call to undefined function: registertype()

code :

 
include_once ('lib/ezimage/classes/ezimagemanager.php');
include_once ('lib/ezimage/classes/ezimageshell.php');

$img =& eZImageManager::instance();
echo $img;
// Register a shell converter using "convert", we name it "convert"
$img->registerType( "convert", new eZImageShell( '', "convert", array(), array(), array() ) );
// Register a converter which uses the PHP extension ImageGD
$img->registerType( "gd", new eZImageGD() );


// Create the JPEG type
$jpeg_type = $img->createMIMEType( "image/jpeg", "\.jpe?g$", "jpg");

$img->setMIMETypes( array( $jpeg_type) );

// Create rule
$tiff2jpg_rule = $img->createRule( "image/tiff", "image/jpg",
"convert", false, false );
// Register the rule and setup the default rule
$img->setRules( array( $tiff2jpg_rule ),
$img->createRule( "*", "image/jpg", "convert",
false, false ) );

// We only want JPEG images
$img->setOutputTypes( array( "mime/jpeg" ) );

$source = "/../../tiff.bin";
$dest_img = $img->convert( $source, "var/cache/" );
print( "<img src="/$dest_img">" );