This is a hack - i needed to achieve the result fast to verify I could use SIG Pro.
Edit the sigpro_engine.php file in the /mambots/content/plugin_jw_sigpro/ folder and replace the GenerateThumbFile($from_name, $to_name) function with this one.
Below your sig_image folder ({gallery}sig_image{/gallery}) create a folder called thumbnails. Copy your main images to this new thumbnail images folder and edit or resize them as required maintaining the same filenames. When you run a page with {gallery}sig_image{/gallery} the new thumbnails are generated from the new thumnails folder content whilst the main pop-up images are generated from the sig_image folder.
Important - before using the modified function you must make sure you delete all current pre-generated images from the temp folder.
This code has no error checking in to make sure the thumbnails folder exists or indeed the images - it is quick and dirty but it works so maybe you can tidy it up and make it useful. I am new to joomla and PHP - hence the noddy code!
// generate thumb from image and save it
function GenerateThumbFile($from_name, $to_name) {
// get source image size (width/height/type)
// orig_img_type 1 = GIF, 2 = JPG, 3 = PNG
$thumb_from_name = null;
$echo_thumb_from_name = null;
// First check if there is a "/" at position 0.
if(strpos($from_name, "/") == 0){
$fiveCounter++;
}
// Check the rest of the string for 5's
while($offset = strpos($from_name, "/", $offset + 1)){
$fiveCounter++;
$lastoffset = $offset;
}
$thumb_from_name = substr($from_name, 0, $lastoffset);
$thumb_from_name .= "/thumbnails/";
$offset1 = $lastoffset + 1;
$offset2 = strlen($from_name) - $lastoffset;
$thumb_from_name .= substr($from_name, $offset1, $offset2 );
list($orig_x, $orig_y, $orig_img_type, $img_sizes) = GetImageSize($thumb_from_name);
// cut image if specified by user
if ($this->cut_x > 0) $orig_x = min($this->cut_x, $orig_x);
if ($this->cut_y > 0) $orig_y = min($this->cut_y, $orig_y);
// should we override thumb image type?
$this->image_type = ($this->image_type != -1 ? $this->image_type : $orig_img_type);
// check for allowed image types
if ($orig_img_type < 1 or $orig_img_type > 3) die("Image type not supported");
if ($orig_x > $this->max_x or $orig_y > $this->max_y) {
// resize
$per_x = $orig_x / $this->max_x;
$per_y = $orig_y / $this->max_y;
if ($per_y > $per_x) {
$this->max_x = $orig_x / $per_y;
}
else {
$this->max_y = $orig_y / $per_x;
}
}
else {
// keep original sizes, i.e. just copy
if ($this->save_to_file) {
@copy($thumb_from_name, $to_name);
}
else {
switch ($this->image_type) {
case 1:
header("Content-type: image/gif");
include($thumb_from_name);
break;
case 2:
header("Content-type: image/jpeg");
include($thumb_from_name);
break;
case 3:
header("Content-type: image/png");
include($thumb_from_name);
break;
}
}
return;
}
if ($this->image_type == 1) {
// should use this function for gifs (gifs are palette images)
$ni = imagecreate($this->max_x, $this->max_y);
}
else {
// Create a new true color image
$ni = ImageCreateTrueColor($this->max_x,$this->max_y);
}
// Fill image with white background (255,255,255)
$white = imagecolorallocate($ni, 255, 255, 255);
imagefilledrectangle( $ni, 0, 0, $this->max_x, $this->max_y, $white);
// Create a new image from source file
$im = $this->ImageCreateFromType($orig_img_type,$thumb_from_name);
// Copy the palette from one image to another
imagepalettecopy($ni,$im);
// Copy and resize part of an image with resampling
imagecopyresampled(
$ni, $im, // destination, source
0, 0, 0, 0, // dstX, dstY, srcX, srcY
$this->max_x, $this->max_y, // dstW, dstH
$orig_x, $orig_y); // srcW, srcH
// save thumb file
$this->SaveImage($ni, $to_name);
}
}