Hey all, here's my problem:
I'm building a website that uses Gallery2 for a photo gallery, and I have a random image from the gallery show up in a boxout. I've used CSS to put a frame around the photo to make it look better. Thing is, the frame is an image of a fixed size, so the random photos from the gallery need to be 160X120 to fit in it. Most of the photos are 160X120, but a few are 120X160. Naturally then, when a 120X160 photo shows up, it gets squashed.
So here's what I wanted to do: Rather than excluding the 120X160 photos, I wanted to write some PHP that would read the dimensions of the photo being sent from the gallery, and change the CSS to use a different sized frame if the photo's width is less than its height. So I added this to the head.
<?php
$image = readfile('http://localhost/gallery/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_itemId=196&g2_show=none');
list($width, $height) = getimagesize($image);
if ($width < $height) {
echo '<link rel="stylesheet" type="text/css" href="styles/img-mod.css" />';
}
?>
And I added this in the boxout where I wanted the photo to appear:
<?php echo $image; ?>
Two things happen: First, the photo I want shows up at the very top of the page, and not in the boxout. Second, I get this error: "Warning: getimagesize(332) [function.getimagesize]: failed to open stream: No such file or directory in index.php on line 15." Why?