PHP Classes
elePHPant
Icontem

File: examples/rotate.php

Recommend this page to a friend!
  Classes of Jose Luis Quintana  >  GImage  >  examples/rotate.php  >  Download  
File: examples/rotate.php
Role: Example script
Content type: text/plain
Description: Example script
Class: GImage
Create graphic images with a fluent interface
Author: By
Last change: fix doc comments
Date: 9 months ago
Size: 734 bytes
 

Contents

Class file image Download
<?php
/*
 * This file is part of GImage.
 *
 * (c) JosÚ Luis Quintana <https://git.io/joseluisq>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

/**
 * Rotate an JPG image.
 *
 * @author JosÚ Luis Quintana <https://git.io/joseluisq>
 */

namespace GImage\Examples;

use
GImage\Image;

require
__DIR__ . '/_config.php';
require
__DIR__ . '/../tests/bootstrap.php';

// Rotate an image to 90║
$image = new Image();
$image
   
->load('http://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=200.jpg')
    ->
scale(0.5)
    ->
rotate(90)
   
// Change to PNG
   
->toPNG()
   
// Add opacity 70%
   
->setOpacity(0.7)
    ->
save(__DIR__ . '/rotate.png');