Changing size and crop options in old modules

Postdate: June 16 2013
Category: Created Modules
Pre 2.0
Applies to: Pre 2

Pre CTLMM 2.0 modules don't have a Blueprint.php to change size and crop settings for images. I show you what to do.


Let's asume you initially set your module to crop an uploaded image and now you or your client don't want crop anymore. Or you want to change the images resize settings.

Where to edit 

Everything happens in the file: action.edititem.php in your module folder.

What to edit

Around line 176 you find this:

// REDIRECTING...
if(isset($params["add_image"])){
...

Depending on your own module the following line looks something like:

$params = array("itemid"=>$item->id,"field"=>"image","tablename"=>"prodcatalogue_item","prefix"=>"item", "startdir"=>"images/prodcatalogue", "size"=>"700x500", "thumb"=>"200x150", "thumbcrop"=>"80x80", "mode"=>"image");

How to edit

The settings that control image handling are:

"size"=>"700x500", "thumb"=>"200x150", "thumbcrop"=>"80x80",

If you want to get rid of cropping, just remove the thumbcrop parameter.

What parameter are available

"size"=>"700x500", // size of the uploaded image
"thumb"=>"80x80", // size of the thumbnail
"crop"=>"1", // cropping of uploaded image is ON
"cropthumb"=>"1", // cropping of thumbnail image is ON
"extensions"=>"jpg,jpeg,png", // what extensions are allowed
"mode"=>"image", // anothe mode could be: file

You can remove all the parameter except mode!
This way no resizing and no cropping will be applied.

Note:

If you remove or add a parameter don't forget to pay attention to the comma! The parameter have to be seperated by commas. EXCEPT the last! See in my example: mode=>"image"

Don't just write "cropthumb"=>"0" to disable cropping on a thumbnail. Remove it completely!