Skip to content

Instantly share code, notes, and snippets.

View BrockleyJohn's full-sized avatar

John Ferguson BrockleyJohn

View GitHub Profile
@BrockleyJohn
BrockleyJohn / create_thumbnail.php
Created June 28, 2016 21:52 — forked from pedroppinheiro/create_thumbnail.php
This php funtion creates a thumbnail of an image. It supports JPEG, JPG, PNG and GIF formats and can be used to define a specific background color, including transparent when dealing with PNG.
<?php
/**
* This code is an improvement over Alex's code that can be found here -> http://stackoverflow.com/a/11376379
*
* This funtion creates a thumbnail with size $thumbnail_width x $thumbnail_height.
* It supports JPG, PNG and GIF formats. The final thumbnail tries to keep the image proportion.
*
* Warnings and/or notices will also be thrown if anything fails.
*
* Example of usage: