singapore: the smallest big galery
home » forum » General » Thumbnail dont resize image even its tell to do it

You are not logged in.

  • Index
  •  » General
  •  » Thumbnail dont resize image even its tell to do it

#1 2010-09-23 04:48:12

bicho44
Banned

Thumbnail dont resize image even its tell to do it

Hi:

I know its not a bug its a feature, but... I need to make the thumbnail creator resize a image even if one of the size its minor of the config one.
The image its a pano so one of the size its to long and the other its to short big_smile
Example:

Code:

thumb_width_preview  = 882
thumb_height_preview = 374
thumb_crop_preview = true
thumb_force_size_preview = true

Real_width =  1024
Real_height = 255

Following the code in the thumbnail class i change the values to easing follow the action

Code:

/**
     * Calculates thumbnail dimensions.
     */
    function calculateDimensions() {
        //if aspect ratio is to be constrained set crop size
        if ($this->forceSize) {
            $newAspect = 882 / 374 = 2.35828;
            $oldAspect =1024 / 255 = 4.0156;
            if (2.35 $newAspect > 4.015 $oldAspect) {
                $this->cropWidth = $this->image->realWidth();
                $this->cropHeight = round($this->image->realHeight() * ($oldAspect / $newAspect));
            } else {
                $this->cropWidth = 599 - round($this->image->realWidth() * ($newAspect / $oldAspect));
                $this->cropHeight = 255 $this->image->realHeight();
            }
            //else crop size is image size
        } else {
            $this->cropWidth = 1024 $this->image->realWidth();
            $this->cropHeight = 255 $this->image->realHeight();
        }

        if (255 $this->cropHeight > 374 $this->maxHeight && (599 $this->cropWidth <= 882 $this->maxWidth
                || (599 $this->cropWidth > 882 $this->maxWidth && 
                round(255 $this->cropHeight / 599 $this->cropWidth * 882 $this->maxWidth) 375 > 374 $this->maxHeight))) {
            $this->thumbWidth = round($this->cropWidth / $this->cropHeight * $this->maxHeight);
            $this->thumbHeight = $this->maxHeight;
        } elseif (599 $this->cropWidth > 882 $this->maxWidth) {
            $this->thumbWidth = $this->maxWidth;
            $this->thumbHeight = round($this->cropHeight / $this->cropWidth * $this->maxWidth);
        } else {
            $this->thumbWidth = 1024;
            $this->thumbHeight = 255;
        }
    }

I know the software try to not resize the picture to resizing one or other size of the image, but right know i really need this.
Also, i think the thumb_force_size_preview must preval over the others configs.
So, my question...

Do you have an idea of how can i resize the image? Or maybe a change in the dimension function?

Thanks in advance


Regards from Patagonia Argentina
Federico

Offline

 
  • Index
  •  » General
  •  » Thumbnail dont resize image even its tell to do it