Forums / Developer / eZImage to eZImageFile

eZImage to eZImageFile

Author Message

Michael de Vries

Thursday 19 March 2009 3:04:01 am

I created a extension for eZPublish for publishing content from another system. For images I was using the eZImage class (didn't notice it was depracated...), but since the 4.1 update, it is not working anymore.

A little investigation showed the eZImage class is removed (this was when I noted it was deprecated, stupid me), so I have to rebuild some stuff. The nice thing about the eZImage class was that it handled a lot of stuff for me, like making reference versions of the image for rss, thumbs, etc and I can't find out how to that with eZImageFile. This way, it looks like eZImageFile is a step backward for me...

The code I was using was the following:

    $image =& eZImage::create( $attribute->attribute( 'id' ), $attribute->attribute( 'version' ) );
    $image->setAttribute( 'contentobject_attribute_id', $attribute->attribute( 'id' ) );
    $image->setAttribute( 'filename', $targetname );
    $image->setAttribute( 'original_filename', $filename );
    $image->setAttribute( 'mime_type', $mime );
    $image->store( );

By using this code, the image was automatically copied from the temporary location ($targetname) to the node of the contentObject. Also, references like thumbs were automatically created.

Is there a way to do this with eZImageFile? And where is documentation about this stuff, all I can find is the API documentation, but sometimes it is not to clear...

Andy Caiger

Wednesday 21 July 2010 2:41:04 pm

I'm very interested in this too! We are upgrading a website from 4.0 to 4.3 and I'm surprised how much code needs to be changed. Is there any documentation anywhere on how to migrate from eZImage to eZImageFile?

EAB - Integrated Internet Success
Offices in England, France & China.
http://www.eab.co.uk http://www.eab-china.com http://www.eab-france.com