Adding Resized Image Links

zombor

Joined: 2003-08-06
Posts: 57
Posted: Tue, 2005-09-20 13:25

I currently have this inserted into the album.tpl file of the matrix theme:

{if !$child.canContainChildren}
        <div style="padding: 6px; padding-left: 0px; font-size: 1.1em; font-weight: normal;">
	<a href="{g->url arg1="view=core:ShowItem" arg2="itemId=`$child.id`"}">[ Low Res ]</a> 
	<a href="{g->url arg1="view=core:ShowItem" arg2="itemId=`$child.id`" arg3="imageViewsIndex=1"}">[ High Res ]</a>
	</div>
{/if}

This has worked fine for me, since all my images have the full, 300dpi High resolution image, and a 72dpi Low resolution image. However, we have some images that are very small (1"x2"@300dpi) that the gallery app does not resize (which is fine since they are so small). I've tried searching on how to detect if the child has a resized image, but havent come up with anything. Is there a way to do this?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-09-20 15:05

you need to modify theme.inc too.

in photo pages, there's already this list of resize versions and full size in the top right. it is generated with modules/core/templates/blocks/PhotoSizes.tpl
but to generate it, you need to load some data from G2.
this is not available for the album page, since the corresponding data isn't yet loaded for albums for each item that is shown on a album page.

you'll have to modify function showAlbumPage() in theme.inc.
you have to search for "imageViews" in modules/core/classes/GalleryTheme.class . copy the code from this class into your showAlbumPage function. and then you'll have to modify this copied code since you have to load the permissions and the available resizes not just for itemId, but for all children.

 
zombor

Joined: 2003-08-06
Posts: 57
Posted: Tue, 2005-09-20 18:18

So I basicly have to find if the child has an imageViews[] length of 1, i.e. only having imageViews[0] set. Is this correct?