Is it possible to set the default height? I can set the default width through image_size in zp-config.php, but I see nowhere to set the height...
I basically want every image to fit within a 460 height x 610 width space. If it's a landscape-oriented image, it's default would be 610 width, and if the image is portrait, it'll have a height of 460.
Comments
http://www.zenphoto.org/support/topic.php?id=247
is this currently the only way?
This should be what you're looking for.
`
<?php printImageDesc(true); ?>
<?php<br />$cw = $iw = 600;
$ch = 480;
$ih = $nw = $nh = 0;`
`if (getFullWidth() < $iw) { $iw = getFullWidth(); }`
`list($nw, $nh) = getSizeCustomImage(0, $iw, $ih);`
`if ($nh > $ch) {
$iw = 0; $ih = $ch;
list($nw, $nh) = getSizeCustomImage(0, $iw, $ih);
}`
`if (getFullHeight() < $ih) { $ih = getFullHeight(); }
?>
alt="<?php echo getImageTitle(); ?>" width="<?php echo $nw; ?>"
height="<?php echo $nh; ?>" />
I replaced your 600 with 610 and 480 with 460 (line 5&6 here) to create the box I need the images to fit in. It almost seems to do what I need, but the landscape oriented images are being cropped/stretched and distorted. Is there something I'm missing? BTW, my images have odd crops, they're all not of a similar aspect ratio... some are really long and skinny, some square. And I tried clearing out the gallery/cache folder, which had no effect.
Thanks so much for helping.
I understand being busy! Thanks for any help you can offer.
then concept_art.
scroll to bottom, last 5 images...
four of those are distorted. The repeated one, I tried shrinking and expanding it's size for testing.
Thinkdreams.
I'll let the artist know you like his stuff
Thinkdreams.
You need to look at this. I can't figure out why it's being cropped so strangely. It's the wierdest thing I've ever seen.
Go to http://www.thinkdreams.com/zen_kevito
I've added some echo statements to help simplify the numbers being output. Might not make a whole lot of sense, but it helped me.
Other than adding "610" to the zp_conf file for image sizing, it's all stock based on joshuaink.
Hope this helps with Kevito's troubles. I've been helping too.
Here's the image.php snippet:
<?php
$cw = $iw = 610;
$ch = 460;
$ih = $nw = $nh = 0;
echo "IW before get full width: " .$iw. "<br>";
echo "IH before get full width: " .$ih. "<br>";
echo "CW before get full width: " .$cw. "<br>";
echo "CH before get full width: " .$ch. "<br>";
if (getFullWidth() < $iw) { $iw = getFullWidth(); }
echo "IW after get full width: " .$iw. "<br>";
list($nw, $nh) = getSizeCustomImage(0, $iw, $ih);
echo "NW: " .$nw. " and NH: " .$nh. "<br>";
echo "CW: " .$cw. " and CH: " .$ch. "<br>";
if ($nh > $ch) {
$iw = 0; $ih = $ch;
echo "IH after nh is greater than ch: " .$ih. "<br>";
list($nw, $nh) = getSizeCustomImage(0, $iw, $ih);
echo "NW: " .$nw. " and NH: " .$nh. "<br>";
}
if (getFullHeight() < $ih) { $ih = getFullHeight(); }
echo "IH after Full Height: " .$ih. "<br>";
?>
<img src="<?php echo getCustomImageURL(0, $nw, $nh); ?>" alt="<?php echo getImageTitle(); ?>" width="<?php echo $nw; ?>" height="<?php echo $nh; ?>" />
And the template-functions.php snippet:
echo "Get Image Params<br>";
echo "US: " .$us. "<br>";
echo "NEWH: " .$newh. "<br>";
echo "H: " .$h. "<br>";
echo "NEWW: " .$neww. "<br>";
echo "CROPW: " .$cropw. "<br>";
echo "CROPH: " .$croph. "<br>";
if (!$us && $newh >= $h && $neww >= $w) {
echo "Return no crop";
return array($w, $h);
} else {
if ($cropw && $cropw < $neww) $neww = $cropw;
if ($croph && $croph < $newh) $newh = $croph;
echo "Return crop with NEWW: " .$neww. " and NEWH: " .$newh. "<br>";
return array($neww, $newh);
}
I found a way to check for the image height, and resample everything within a 610/460 boundary.
Here's the mods to the image.php (using a stock JoshuaInk):
<div id="fullplate-photo">
<h2><?php printImageDesc(true); ?></h2>
<?php
$cw = $iw = 610;
$ch = 460;
$ih = $nw = $nh = 0;
list($nw, $nh) = getSizeCustomImage(0, $cw, $ch);
echo "NW: " .$nw. " and NH: " .$nh. "<br>";
if ($nh > $ch) { ?>
" title="<?php echo getImageTitle();?>"><?php printCustomSizedImage(getImageTitle(),0,0,$ch); ?>
<?php } else { ?>
" title="<?php echo getImageTitle();?>"><?php printDefaultSizedImage(getImageTitle()); ?>
<?php } ?>
</div>
" title="<?php echo getImageTitle();?>"><?php printCustomSizedImage(getImageTitle(),0,0,$ch); ?>
" title="<?php echo getImageTitle();?>"><?php printDefaultSizedImage(getImageTitle()); ?>
(still very much in progress: http://federiconovelo.com/gallery/)
http://www.zenphoto.org/support/topic.php?id=602#post-3706
<?php
$thumbalbumref = getAlbumTitle();
$thumbtoimage = getAlbumThumb();
$newimagefromthumb = str_replace("/zen_kevito/$thumbalbumref/image/thumb/","",$thumbtoimage);
echo $newimagefromthumb;
?>
<iframe name="content" src="image.php?album=<?php echo $thumbalbumref ?>&image=<?php echo $newimagefromthumb ?>" frameborder="0" scrolling="yes" height="501" width="650" style="z-index: 0"></iframe>
In the portion above that does the string replacement, you'll have to add in the path to your specific subdir for zenphoto. Those of you who are more adept at coding may be able to come up with a more elegant solution.
Enjoy