public static function getResponsiveWidthSteps($dim, $imageDimensions)
    {
        $ret = array();
        if (is_string($imageDimensions)) {
            if (!file_exists($imageDimensions)) {
                return array();
            }
            $size = getimagesize($imageDimensions);
            $imageDimensions = array(
                'width' => $size[0],
                'height' => $size[1],
            );
        } else if ($imageDimensions instanceof Kwf_Uploads_Row) {
            $imageDimensions = $imageDimensions->getImageDimensions();
        } else if ($imageDimensions instanceof Imagick) {
            $imageDimensions = array(
                'width' => $imageDimensions->getImageWidth(),
                'height' => $imageDimensions->getImageHeight()
            );
        }

        if (!$imageDimensions['width']) {
            throw new Kwf_Exception("Image must have a width");
        }

        $maxWidth = $dim['width'] * 2;
        if ($imageDimensions['width'] < $dim['width'] * 2) {
            $maxWidth = $imageDimensions['width'];
        }
        $calculateWidth = $dim['width'];
        if ($imageDimensions['width'] < $dim['width']) {
            $calculateWidth = $imageDimensions['width'];
        }

        $width = $calculateWidth;
        do {
            $ret[] = $width;
            $width -= self::_getOffsetAtWidth($width);
        } while ($width > 0);


        $width = $calculateWidth;
        while (true) {
            $width += self::_getOffsetAtWidth($width);
            if ($width >= $maxWidth) {
                break;
            }
            $ret[] = $width;
        }
        $ret[] = $maxWidth;
        sort($ret);

        return $ret;
    }
public static function getResponsiveWidthSteps($dim, $imageDimensions)
    {
        $ret = array();
        if (is_string($imageDimensions)) {
            if (!file_exists($imageDimensions)) {
                return array();
            }
            $size = getimagesize($imageDimensions);
            $imageDimensions = array(
                'width' => $size[0],
                'height' => $size[1],
            );
        } else if ($imageDimensions instanceof Kwf_Uploads_Row) {
            $imageDimensions = $imageDimensions->getImageDimensions();
        } else if ($imageDimensions instanceof Imagick) {
            $imageDimensions = array(
                'width' => $imageDimensions->getImageWidth(),
                'height' => $imageDimensions->getImageHeight()
            );
        }

        if (!$imageDimensions['width']) {
            throw new Kwf_Exception("Image must have a width");
        }

        $maxWidth = $dim['width'] * 2;
        if ($imageDimensions['width'] < $dim['width'] * 2) {
            $maxWidth = $imageDimensions['width'];
        }
        $calculateWidth = $dim['width'];
        if ($imageDimensions['width'] < $dim['width']) {
            $calculateWidth = $imageDimensions['width'];
        }

        $width = $calculateWidth;
        do {
            $ret[] = $width;
            $width -= self::_getOffsetAtWidth($width);
        } while ($width > 0);


        $width = $calculateWidth;
        while (true) {
            $width += self::_getOffsetAtWidth($width);
            if ($width >= $maxWidth) {
                break;
            }
            $ret[] = $width;
        }
        $ret[] = $maxWidth;
        sort($ret);

        return $ret;
    }
public static function getResponsiveWidthSteps ( $ dim , $ imageDimensions ) { $ ret = array ( ) ; if ( is_string ( $ imageDimensions ) ) { if ( ! file_exists ( $ imageDimensions ) ) { return array ( ) ; } $ size = getimagesize ( $ imageDimensions ) ; $ imageDimensions = array ( 'width' => $ size [ 0 ] , 'height' => $ size [ 1 ] , ) ; } else if ( $ imageDimensions instanceof Kwf_Uploads_Row ) { $ imageDimensions = $ imageDimensions -> getImageDimensions ( ) ; } else if ( $ imageDimensions instanceof Imagick ) { $ imageDimensions = array ( 'width' => $ imageDimensions -> getImageWidth ( ) , 'height' => $ imageDimensions -> getImageHeight ( ) ) ; } if ( ! $ imageDimensions [ 'width' ] ) { throw new Kwf_Exception ( "Image must have a width" ) ; } $ maxWidth = $ dim [ 'width' ] * 2 ; if ( $ imageDimensions [ 'width' ] < $ dim [ 'width' ] * 2 ) { $ maxWidth = $ imageDimensions [ 'width' ] ; } $ calculateWidth = $ dim [ 'width' ] ; if ( $ imageDimensions [ 'width' ] < $ dim [ 'width' ] ) { $ calculateWidth = $ imageDimensions [ 'width' ] ; } $ width = $ calculateWidth ; do { $ ret [ ] = $ width ; $ width -= self :: _getOffsetAtWidth ( $ width ) ; } while ( $ width > 0 ) ; $ width = $ calculateWidth ; while ( true ) { $ width += self :: _getOffsetAtWidth ( $ width ) ; if ( $ width >= $ maxWidth ) { break ; } $ ret [ ] = $ width ; } $ ret [ ] = $ maxWidth ; sort ( $ ret ) ; return $ ret ; }
Returns supported image-widths of specific image with given base-dimensions
Returns supported image - widths of specific image with given base - dimensions