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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 31 2025 00:19:36
Script start
Timing: Jan 31 2025 00:19:36
Module start 'layout'
Timing: Jan 31 2025 00:19:36
Module start 'content'
Timing: Jan 31 2025 00:19:37
Module end 'content'
Timing: Jan 31 2025 00:19:37
Script end

Main resources:

Total runtime0.8925 sec
Peak memory usage8,192.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0046 588.1250151.2109
Module start 'layout' 0.00460.0032 739.3359220.6719
Module start 'content' 0.00790.8837 960.00784,430.3672
Module end 'content' 0.89150.0009 5,390.37508.0313
Script end 0.8925  5,398.4063 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.3644160.0002
Check MTime0.00120.1346160.0001
Mysql Total
Database connection0.00070.076010.0007
Mysqli_queries0.819091.7588540.0152
Looping result0.00040.0465520.0000
Template Total0.849295.120.4246
Template load0.00200.225320.0010
Template processing0.847194.914220.4236
Template load and register function0.00130.149710.0013
states
state_id_array0.00150.173710.0015
state_identifier_array0.00060.071720.0003
Override
Cache load0.00160.1839120.0001
Sytem overhead
Fetch class attribute can translate value0.00140.153420.0007
Fetch class attribute name0.00230.252430.0008
XML
Image XML parsing0.00200.226720.0010
class_abstraction
Instantiating content class attribute0.00000.001130.0000
General
dbfile0.00500.5645160.0003
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 9
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs