infoweb\cms\models\Image::interlaceFix PHP Метод

interlaceFix() публичный Метод

Fix interlaceFix
public interlaceFix ( type $file ) : boolean
$file type
Результат boolean
    public function interlaceFix($file)
    {
        $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
        if ($ext == 'png') {
            $phpimage = imagecreatefrompng($file);
            imagealphablending($phpimage, false);
            imagesavealpha($phpimage, true);
            if ($phpimage) {
                imageinterlace($phpimage, 0);
                ob_start();
                imagepng($phpimage);
            } else {
                unset($phpimage);
            }
        } elseif ($ext == 'jpeg') {
            $phpimage = imagecreatefromjpeg($file);
            if ($phpimage) {
                imageinterlace($phpimage, 0);
                ob_start();
                imagejpeg($phpimage);
            } else {
                unset($phpimage);
            }
        }
        if (isset($phpimage)) {
            imagedestroy($phpimage);
            return ob_get_clean();
        }
        return false;
    }