Skip to content

Instantly share code, notes, and snippets.

@sineld
Created March 9, 2013 11:15
Show Gist options
  • Select an option

  • Save sineld/5123881 to your computer and use it in GitHub Desktop.

Select an option

Save sineld/5123881 to your computer and use it in GitHub Desktop.
Php Image Works
<?php
$watermark = Image::open('upload/images/watermark.png');
$sourceImage = 'upload/images/1920x1080.jpg';
$smallImage = 'upload/images/samples/small.jpg';
$bigImage = 'upload/images/samples/big.jpg';
$resized = Image::open($sourceImage)
->cropResize(800, 800)
->save($bigImage, 'jpg', 65);
Image::open($resized)
->zoomCrop(100, 100)
->save($smallImage, 'jpg', 85);
$big = Image::open($resized);
$big->merge($watermark, $big->width()-$watermark->width()-20, $big->height()-$watermark->width()-20)
->save($bigImage, 'jpg', 65);
$watermark = Image::open('upload/images/watermark.png');
$sourceImage = 'upload/images/1200x1600.jpg';
$smallImage = 'upload/images/samples/small2.jpg';
$bigImage = 'upload/images/samples/big2.jpg';
$resized = Image::open($sourceImage)
->cropResize(800, 800)
->save($bigImage, 'jpg', 65);
Image::open($resized)
->zoomCrop(100, 100)
->save($smallImage, 'jpg', 85);
$big = Image::open($resized);
$big->merge($watermark, $big->width()-$watermark->width()-20, $big->height()-$watermark->width()-20)
->save($bigImage, 'jpg', 65);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment