Forums / Setup & design / Only show image table if the image exists?
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'> </TD></TR> </TABLE>
best regardstrondåge
trondåge
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....
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
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=referenceFilters[]=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=referenceFilters[]=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
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?
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.