Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private function minimilize($savefile){
- $image=new Gmagick($savefile);
- $width=$image->getimagewidth();
- $height=$image->getimageheight();
- $standartWidth='';
- $standartHeight='';
- $x='';
- $y='';
- if($width>$height) {
- $standartWidth=1024;
- $standartHeight=756;
- $masWidth=1300;
- $masHeight=900;
- $kw=$width/$masWidth;
- $wx=$width/$kw;
- $image->setCompressionQuality(80);
- $image->profileimage('*',null);
- $image->resizeimage($wx, $wx, null, 1, true);
- $x = (($masWidth - $standartWidth) / 2);
- $y = (($masHeight - $standartHeight) / 2);
- }
- if($width<$height) {
- $standartWidth=1024;
- $standartHeight=756;
- $koef=$width/1024;
- $wx=$height/$koef;
- $image->setCompressionQuality(80);
- $image->profileimage('*',null);
- $image->resizeimage($wx, $wx, null, 1, true);
- $x = 0;
- $y = $wx/7.75;
- }
- $image->cropimage($standartWidth, $standartHeight, $x,$y);
- $image->writeimage($savefile);
- $image->destroy();
Add Comment
Please, Sign In to add comment