Forums / Setup & design / Only show image table if the image exists?

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.

eZ debug

Timing: Jan 31 2025 04:11:10
Script start
Timing: Jan 31 2025 04:11:10
Module start 'content'
Timing: Jan 31 2025 04:11:10
Module end 'content'
Timing: Jan 31 2025 04:11:10
Script end

Main resources:

Total runtime0.1591 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0048 589.3516180.8125
Module start 'content' 0.00480.0047 770.164197.9453
Module end 'content' 0.00960.1495 868.1094526.8750
Script end 0.1591  1,394.9844 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00322.0027200.0002
Check MTime0.00140.8738200.0001
Mysql Total
Database connection0.00060.379710.0006
Mysqli_queries0.118374.32621410.0008
Looping result0.00100.64631390.0000
Template Total0.149193.710.1491
Template load0.00080.503510.0008
Template processing0.148393.225310.1483
Override
Cache load0.00060.355110.0006
Sytem overhead
Fetch class attribute can translate value0.00070.428010.0007
XML
Image XML parsing0.00020.127710.0002
General
dbfile0.00654.0840200.0003
String conversion0.00000.003130.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs