Only show image table if the image exists?

Author Message

Trond Åge Kvalø

Monday 15 March 2004 12:43:44 am

I have altered the Folder class a bit to include an image. Then I've made a template that shows the image in a right justified table.

Problem is that the image is not required, and now I want to check to see if there's an image before I show the table.

At the moment I'm also assuming a fixed size on this image. But that is bit strict. Could someone help me with how to scale the image proportionally to a fixed with?

here's the code for my image table:

{section loop=$children}
	<TABLE border='0' cellspacing='0' cellpadding='0' align='right' CLASS='image-right'>
		<tr><TD width='155'><img src='{$:item.object.data_map.bilde.content[reference].full_path}' width='155' height='88'></TD>
		</tr><tr><TD CLASS='space10px'>&nbsp;</TD></TR>
	</TABLE>

best regards
trondåge

trondåge

Trond Åge Kvalø

Monday 15 March 2004 12:54:03 am

Ehhrm.... it was actually in the docs..... How bizarre. That's the last place I'd look ;-o

http://ez.no/ez_publish/download/changelogs/ez_publish_3_3/new_image_system

well, well. Now I'll try to make it work....

trondåge

trondåge

Trond Åge Kvalø

Monday 15 March 2004 1:21:40 am

The docs says:

"A filter entry in the image alias consist of the name of the filter and the filter parameters separated with a =, each parameter is separated with a semicolon (;)"

But how about giving us an example?

It's quite annoying when the documentation guides you <b>almost</b> to the solution. Compare it to reading a crime novel where the last chapters are missing....

From what I understand from the docs this is how I should do it:

{$:item.object.data_map.bilde.content.url.geometry/scalewidth=155}

But I have a feeling that this is not entirely correct... please show me how to do this

best regards
trondåge

trondåge

Tore Skobba

Monday 15 March 2004 1:57:41 am

Hi

As I understand it you have two problems. Need to scale image and conditional template code for displaying folders with and without an image.

Image scaling is set up in the settings/override/image.ini.append. There you will find lots of stuff. Basically you must make an filter for your image. For example:

# Scale images to 230;110. NOT keeping aspect ratio
[ingress]
Reference=reference
Filters[]=geometry/scaleexact=230;110

# Scale images larger than 460;460 down to keeping aspect ratio.. I.e the image is simply NEVER widther og heigher than 460 px.
[xlarge]
Reference=reference
Filters[]=geometry/scaledownonly=460;460

Then in your template you must use code to view images:

{section show=$item.data_map.bilde.content.is_valid}
{* Image is available *}
<a href={$item.data_map.bilde.content.orginial.url|ezroot}>{attribute_view_gui attribute=$item.data_map.bilde image_class="ingress"}</a>
{* Image size is controlled by using image class="filtername", where filter name is in image.ini.append.
{section-else}
{* There is no image *}
{/section}

PS: Replace $item with $node if not within an sectin loop.

Cheers
Tore

Trond Åge Kvalø

Monday 15 March 2004 3:39:57 am

Thank you, Tore!

Much appreciated :-)

As far as I've understood, I also have to specify an AliasList[]=my_new_filter_name in the [AliasSettings] section , right?

And what does the Reference=reference line do?

trondåge

trondåge

Tore Skobba

Monday 15 March 2004 4:10:08 am

>I also have to specify an AliasList[]=my_new_filter_name in the [AliasSettings] >section , right?

Maybee, maybee not. If the default AliasList does not suit your needs then you define your own in the design/override/image.ini.append file.

>And what does the Reference=reference line do?

Beats me, probably somehting to do with some advanced functionality.. I just keep it there.. I.e when making an new filter I use copy&paste.

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 18 2025 22:12:46
Script start
Timing: Jan 18 2025 22:12:46
Module start 'layout'
Timing: Jan 18 2025 22:12:46
Module start 'content'
Timing: Jan 18 2025 22:12:47
Module end 'content'
Timing: Jan 18 2025 22:12:47
Script end

Main resources:

Total runtime0.6854 sec
Peak memory usage4,096.0000 KB
Database Queries66

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 589.1641152.6406
Module start 'layout' 0.00580.0039 741.804739.4766
Module start 'content' 0.00960.6741 781.2813541.2266
Module end 'content' 0.68370.0016 1,322.507816.1250
Script end 0.6854  1,338.6328 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.4746160.0002
Check MTime0.00140.2002160.0001
Mysql Total
Database connection0.00070.104510.0007
Mysqli_queries0.623690.9829660.0094
Looping result0.00060.0935640.0000
Template Total0.652595.220.3263
Template load0.00180.265020.0009
Template processing0.650794.936520.3253
Template load and register function0.00020.034910.0002
states
state_id_array0.00150.220710.0015
state_identifier_array0.00090.127220.0004
Override
Cache load0.00160.2291600.0000
Sytem overhead
Fetch class attribute can translate value0.00080.121620.0004
Fetch class attribute name0.00140.199160.0002
XML
Image XML parsing0.00030.043020.0001
class_abstraction
Instantiating content class attribute0.00000.002360.0000
General
dbfile0.00230.3415100.0002
String conversion0.00000.001540.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
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
13content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
7content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 30
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs