db; } public function generatePreview( $ifile, $ofile, $w, $h) { list($width, $height) = getimagesize($ifile); // echo "convert -define jpeg:size=".$w."x".$h."+".$x."+".$y." $ifile -crop ".$w."x".$h."+".$x."+".$y." -thumbnail ".$ww."x".$hh."^ -gravity center $ofile"; umask(0113); exec("convert -define jpeg:size=".$width."x".$height."+0+0 $ifile -thumbnail ".$w."x".$h."^ -gravity center -background '#FFFFFF' -quality 95 $ofile" ); chmod($ofile, 0664); } public function generateImageCrop( $ifile, $ofile, $ww, $hh, $param ) { // to do add rotate, etc extract( $param ); list($width, $height) = getimagesize($ifile); $addp = ''; if( strrpos($ofile, '.webp') == strlen($ofile) - strlen('.webp') ) { $addp = " -background '#FFFFFF' -alpha off -strip Plane -quality 88 -define webp:method=6 "; //-interlace } umask(0113); // echo "convert -define jpeg:size=".$w."x".$h."+".$x."+".$y." $ifile -crop ".$w."x".$h."+".$x."+".$y." -thumbnail ".$ww."x".$hh."^ -gravity center $ofile"; exec("convert -define jpeg:size=".$width."x".$height."+0+0 $ifile -crop ".$w."x".$h."+".$x."+".$y." -thumbnail ".$ww."x".$hh."^ $addp -gravity center $ofile" ); //> /dev/null 2>&1 & > /dev/null & в фоне // chmod($ofile, 0664); } }