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;
}
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.