Last active
April 10, 2017 16:42
-
-
Save adrianoalves/1205339 to your computer and use it in GitHub Desktop.
WideImage: instanciando e inserindo legenda com sombreado e marca d'agua
This file contains hidden or 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 | |
| // testando manipulacao de imagens com API WideImage | |
| $image = WideImage_Image::load( APPLICATION_PATH.'/../public/img/front/icon/64/image.jpg' )->resize(null, 500); | |
| $waterMark = WideImage_Image::load( APPLICATION_PATH.'/../public/img/front/icon/64/php.png' )->resize(100); | |
| // obtendo o canvas da imagem para escrever sobre ela | |
| $canvas = $image->getCanvas(); | |
| $canvas->useFont('fonts/GOTHIC.TTF', 18, $image->allocateColor(100, 100, 115) ); | |
| $canvas->writeText('center', 'bottom-10', 'legenda para a imagem'); | |
| $canvas->useFont('fonts/GOTHIC.TTF', 18, $image->allocateColor(50, 50, 255) ); | |
| $canvas->writeText('center-1', 'bottom-11', 'legenda para a imagem'); | |
| $image->roundCorners( 15 ) // arredondamento de todos os cantos da imagem | |
| ->merge($waterMark, 30, 25) // aplicando uma imagem sobre a outra, o quarto param é a opacidade em % | |
| ->saveToFile('formatada.png'); // nome da caminho/imagem a ser salva |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment