Created
December 14, 2014 21:19
-
-
Save phosphore/03b29f44e2d6f4c42559 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include 'lib/WideImage.php'; | |
/* Carico le risorse */ | |
$imagesopra = WideImage::load("a.png"); /* LAYER SOPRA immagine iniziale caricata con WideImage */ | |
$image = WideImage::load("a.png"); /* caricata con WideImage, andremo a modificare questa */ | |
/* Trovo x e y */ | |
$sizex = $image->getWidth(); | |
$sizey = $image->getHeight(); | |
if($sizex < $sizey) { /* immagine verticale */ | |
/* resize e taglio */ | |
$image->resize($sizey, null, 'fill')->crop('center', 'center', $sizey, $sizey)->saveToFile("b.png"); /* larghezza, altezza */ | |
/* blur gaussiano */ | |
exec("convert b.png -blur 0x11 b.png"); | |
/* ricarico b */ | |
$imagesotto = WideImage::load("b.png"); | |
/* centriamo il livello imagesopra in imagesotto e fondiamoli */ | |
$imagesotto->merge($imagesopra, 'center', 'center', $sizex)->saveToFile("b.png"); | |
} else { /* immagine orizzontale */ | |
/* resize e taglio */ | |
$image->resize(null, $sizex, 'fill')->crop('center', 'center', $sizex, $sizex)->saveToFile("b.png"); /* larghezza, altezza */ | |
/* blur gaussiano */ | |
exec("convert b.png -blur 0x11 b.png"); | |
/* ricarico b */ | |
$imagesotto = WideImage::load("b.png"); | |
/* centriamo il livello imagesopra in imagesotto e fondiamoli */ | |
$imagesotto->merge($imagesopra, 'center', 'center', $sizey)->saveToFile("b.png"); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment