Information
This hack will automatically resize images that were uploaded using an image upload field. Instead of creating only one thumbnail also the original image will be resized. So this can help you saving webspace. Credits: apollo13
Installation
=========================
changes in pnimageapi.php
=========================
insert after:
Code
array('image' => $im,
'thumbnailFilePath' => $args['thumbnailFilePath']) );
Code
array('image' => $im,
'thumbnailFilePath' => $args['imageFilePath'],
'thumbnailsize' => 200) ); //define your imagesize here
Altered by VideoKid
Additionally for smaller images I changed it to:
Code
$max = "480"; //define your imagesize here
if( ($width > $max) || ($height > $max) ){
$ok = pnModAPIFunc( 'pagesetter', 'image', 'createThumbnailFromGD',
array('image' => $im,
'thumbnailFilePath' => $args['imageFilePath'],
'thumbnailsize' => $max) );
}
Code
$thumbnailSize = 100;
Code
{
$thumbnailSize =$args['thumbnailsize'];
}
changes in pneditapi
======================
insert after:
Code
if ($ok === false)
return false;
Code
{
$newfile=$uploadDir . '/' .$uploadFilename;
$image_info = getimagesize($newfile) ;
$uploadInfo['type']=$image_info['mime'];
$uploadInfo['size']=filesize($newfile);
$fieldData = $uploadInfo['type'] . '|' . $uploadInfo['size'] . '|' . $uploadFilename . '|' . $uploadInfo['name'];
}

