ZenphotoCMS Forum
Random Images - skip Widths less than.. - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: Random Images - skip Widths less than.. (/thread-2075.html)



Random Images - skip Widths less than.. - zloh - 2008-01-12

Hi..
I'm using a variant of the effervescence theme, and my problem is with the random image function "stretching" any images in portrait orientation/aspect ratio (which are thinner than the random banner)
- i don't want to make the tall-skinny images any bigger because they'll be too tall, and they're fine for normal use
- so is there a way to get a random function to just skip any images that aren't wide enough? (e.g. anything with a width less than 600px)

apologies if this is just obvious..

Thanks in advance for any advice!


Random Images - skip Widths less than.. - sbillard - 2008-01-12

You will have to add code to the theme to check the width of the image returned and get another if it is too narrow.


Random Images - skip Widths less than.. - zloh - 2008-01-13

- i'm sure if i was a programmer, and not just a dabbler, this would only take a sec, and be very easy to do..
maybe someone else could give me a basic example of how this can be done?

anyway, thanks for your reply! ZP is easily the best php gallery currently in existance.


Random Images - skip Widths less than.. - sbillard - 2008-01-13

OK:

Where the code reads: ` <?php printHeadingImage(getRandomImages()); ?>` change it to
`<?php

$image = getRandomImages();

while (!is_null($images) && !isLandscape($image)) { $image = getRandomImages(); }

printHeadingImage($image);

?>`

Warning: I have not tried this. Also, there may not be a landscape image.