Page 1 of 1

Cropping thumbnails in different position

Posted: 24 Nov 2009, 13:00
by h_razack
Hi,

I was wondering whether there was a way to change how the thumbnails are cropped.

I have a set of portrait images, with people posing standing, and their heads are cut off in the thumbnails, which looks rather strange.

Is there a way to crop the images from the top, rather than in the center? (I don't think it's feasible in the options, but could you please point me where in the php code this might be changed?)

Thanks!

Posted: 25 Nov 2009, 11:37
by mjau-mjau
Yea, thats a little difficult and cant be set from the admin. Usually we recommend either creating thumbnails manually(from your dektop), or using "scaletobox" scaling method for these thumbnails so that they are not cropped.

You could edit the file imagevue/include/ivImage.class.php - I believe the code that positions the crop, is here:
Code
	function crop($width, $height)
	{
		$x = floor(($this->imageinfo['width'] - $width) / 2);
		$y = floor(($this->imageinfo['height'] - $height) / 2);
Just from the top of my head, I am guessing you could try setting "$y = 0" to get it crop from the top, but dont take my word for it. Be careful, and make sure you make a backup before editing.

Posted: 25 Nov 2009, 13:19
by h_razack
Thanks a lot for your reply. I'll try that!