Jump to content

Creating thumbnail images, used to work, now doesnt work


jwhite68

Recommended Posts

My existing code has the following function, which uses some form of 'convert' function to create a thumbnail file.  However, its not working on the web server - even though it used to.  I have inherited this code, and do not know the background behind it.

 

Does anyone recognise it, or know what this 'convert' function is?  See 'this line' marker below.

I cannot see any PHP function called convert, and assume its some library that needs to be compiled into PHP, or maybe referencing a PERL function?

 

function resizeByWidth($input,$output,$width,$onlyIfBigger=true){
/*
Description : Resizes regular image by given height
Parameters :
	input :  path to the file
	output :path to output file 
	height :the new height
	onlyIfBigge : wheather to resize if image height is smaller then new height 		
Returns : 
	true : if success 
	false : if file not exists or not a regular image
*/
if($pic_info = checkImage($input)){
	if($pic_info[1]<$width && $onlyIfBigger){
		copy($input,$output);
		echo'File copy';
		return false;
	}
	$proportions = $width/$pic_info[1];
	$newHeight = round($pic_info[2] * $proportions); 
	$cmd = 'convert '.$input.' -thumbnail '.$width.'x'.$newHeight.' '.$output;  <--- this line
	$res = `$cmd`;
	echo $res;
}
else{
	return false;
}
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.