in views, i created a node type view, photo (for use IN the node type 'photo'), that lists displays a cropped/scaled image, and then some info about the image.

in my views-view-field.tpl.php for the 'image field', i'm trying to create a getimagesize if statement that essentially says "if the image's width is greater than it's height, print the wide ImageCache preset, else print the tall preset"

i'm doing this:

<?php 

$bigimage = $fields['field_image_fid_4']->content;
$wide = $fields['field_image_fid_1']->content;
$tall = $fields['field_image_fid_3']->content;
list($width, $height, $type, $image_attributes) = getimagesize($bigimage);
if ($width > $height) {
    print $wide;
}	else {
print $tall;
}

?>

sometimes i'm getting an error that reports "warning getimagesize() [function.getimagesize]: Filename cannot be empty"

any thoughts?

Comments

fizk’s picture

Status: Active » Closed (fixed)

Please reopn if this is still an issue with ImageCache 6.x-2.0-rc1.