I know this is possible, but I’m not a good enough coder to figure it out.
Can anyone mod the RandomImage code so that it lets you input a custom height or width or both parameters rather than the snippet using the image’s exact dimensions from the GetImageSize function?
Something like this...
[!RandomImage? &folder=`assets/images/random` &border=`1` &width=`150`!]
I want to use RandomImage to display some photo images at 400px wide, but the problem is some are 401px, 403px, etc.
I also want to use the same snippet for some thumbnails at 100px wide, but some are 103px, etc. I know I can just hardcode these values into the snippet by replacing the
$imgSize[3] (in the line of code below) and then create a duplicate snippet for each set of images I want to resize, but I’d like to do everything with just one RandomImage snippet. I know it’s possible, but I can’t figure it out.
return( '<div id="rndImage"><img src="' . $image_name . '" ' . $imgSize[3] . ' alt="" border="' . $border . '" /></div>' );