This hack was for an old version of the plugin, so you are wiping out all of the updates.
Relevant changes are as follows:
Replace the existing function sobi_gallery_resampleImage with the following:
function sobi_gallery_resampleImage($file, $thumb, $fileType) {
$config =& sobi2Config::getInstance();
if($thumb) {
$width = $this->thmW;
$height = $this->thmH;
$resize = $this->alwaysResizeThumb;
}
else {
$width = $this->imgW;
$height = $this->imgH;
$resize = $this->alwaysResizeImages;
}
list($width_orig, $height_orig, $imgType) = getimagesize($file);
if(!$resize && (($width_orig < $width) && ($height_orig < $height)))
{
return true;
}
$ratio_orig = $width_orig/$height_orig;
If ($thumb){
if ($width/$height < $ratio_orig)
{
$width = $height*$ratio_orig;
}
else
{
$height = $width/$ratio_orig;
}
} else {
if ($width/$height > $ratio_orig)
{
$width = $height*$ratio_orig;
}
else
{
$height = $width/$ratio_orig;
}
}
switch($imgType) {
case 1:
if(!($image_p = imagecreatetruecolor($width, $height)))
return false;
if(!($image = imagecreatefromgif($file)))
return false;
if(!(imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig)))
return false;
if(!(imagegif($image_p, $file)))
return false;
break;
case 2:
if(!($image_p = imagecreatetruecolor($width, $height)))
return false;
if(!($image = imagecreatefromjpeg($file)))
return false;
if(!(imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig)))
return false;
if(!(imagejpeg($image_p, $file,$config->key( "general", "jpeg_image_quality", 75 ))))
return false;
break;
case 3:
if(!($image_p = imagecreatetruecolor($width, $height)))
return false;
if(!($image = imagecreatefrompng($file)))
return false;
if(!(imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig)))
return false;
if(!(imagepng($image_p, $file,$config->key( "general", "png_image_compression", 0 ))))
return false;
break;
}
imagedestroy($image_p);
imagedestroy($image);
return true;
}
For a sobitwo clone it should be (i just did a manual once over so I might have missed one ot two):
function sobitwo_gallery_resampleImage($file, $thumb, $fileType) {
$config =& sobitwoConfig::getInstance();
if($thumb) {
$width = $this->thmW;
$height = $this->thmH;
$resize = $this->alwaysResizeThumb;
}
else {
$width = $this->imgW;
$height = $this->imgH;
$resize = $this->alwaysResizeImages;
}
list($width_orig, $height_orig, $imgType) = getimagesize($file);
if(!$resize && (($width_orig < $width) && ($height_orig < $height)))
{
return true;
}
$ratio_orig = $width_orig/$height_orig;
If ($thumb){
if ($width/$height < $ratio_orig)
{
$width = $height*$ratio_orig;
}
else
{
$height = $width/$ratio_orig;
}
} else {
if ($width/$height > $ratio_orig)
{
$width = $height*$ratio_orig;
}
else
{
$height = $width/$ratio_orig;
}
}
switch($imgType) {
case 1:
if(!($image_p = imagecreatetruecolor($width, $height)))
return false;
if(!($image = imagecreatefromgif($file)))
return false;
if(!(imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig)))
return false;
if(!(imagegif($image_p, $file)))
return false;
break;
case 2:
if(!($image_p = imagecreatetruecolor($width, $height)))
return false;
if(!($image = imagecreatefromjpeg($file)))
return false;
if(!(imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig)))
return false;
if(!(imagejpeg($image_p, $file,$config->key( "general", "jpeg_image_quality", 75 ))))
return false;
break;
case 3:
if(!($image_p = imagecreatetruecolor($width, $height)))
return false;
if(!($image = imagecreatefrompng($file)))
return false;
if(!(imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig)))
return false;
if(!(imagepng($image_p, $file,$config->key( "general", "png_image_compression", 0 ))))
return false;
break;
}
imagedestroy($image_p);
imagedestroy($image);
return true;
}
Greg