public static function getHandyScaleFactor($original)
    {
        $targetSize = array(600, 600, 'cover' => false);

        if (is_string($original)) {
            if (!file_exists($original)) return 1;
            $size = getimagesize($original);
            $original = array(
                'width' => $size[0],
                'height' => $size[1],
                'rotation' => self::getExifRotation($original),
            );
        }

        $target = Kwf_Media_Image::calculateScaleDimensions($original, $targetSize);
        if (abs($original['rotation']) == 90) {
            $original = array('width'=>$original['height'], 'height'=>$original['width']);
        }
        if ($original['width'] <= $target['width'] && $original['height'] <= $target['height']) {
            return 1;
        } else {
            return $original['width'] / $target['width'];
        }
    }
public static function getHandyScaleFactor($original)
    {
        $targetSize = array(600, 600, 'cover' => false);

        if (is_string($original)) {
            if (!file_exists($original)) return 1;
            $size = getimagesize($original);
            $original = array(
                'width' => $size[0],
                'height' => $size[1],
                'rotation' => self::getExifRotation($original),
            );
        }

        $target = Kwf_Media_Image::calculateScaleDimensions($original, $targetSize);
        if (abs($original['rotation']) == 90) {
            $original = array('width'=>$original['height'], 'height'=>$original['width']);
        }
        if ($original['width'] <= $target['width'] && $original['height'] <= $target['height']) {
            return 1;
        } else {
            return $original['width'] / $target['width'];
        }
    }
public static function getHandyScaleFactor ( $ original ) { $ targetSize = array ( 600 , 600 , 'cover' => false ) ; if ( is_string ( $ original ) ) { if ( ! file_exists ( $ original ) ) return 1 ; $ size = getimagesize ( $ original ) ; $ original = array ( 'width' => $ size [ 0 ] , 'height' => $ size [ 1 ] , 'rotation' => self :: getExifRotation ( $ original ) , ) ; } $ target = Kwf_Media_Image :: calculateScaleDimensions ( $ original , $ targetSize ) ; if ( abs ( $ original [ 'rotation' ] ) == 90 ) { $ original = array ( 'width' => $ original [ 'height' ] , 'height' => $ original [ 'width' ] ) ; } if ( $ original [ 'width' ] <= $ target [ 'width' ] && $ original [ 'height' ] <= $ target [ 'height' ] ) { return 1 ; } else { return $ original [ 'width' ] / $ target [ 'width' ] ; } }
Returns an image with a size which should be good to work with.
Acutally this is a 600x600 max-width. If it's smaller in both dimensions
it will keep it's original size.
Returns an image with a size which should be good to work with . Acutally this is a 600x600 max - width . If it s smaller in both dimensions it will keep it s original size .