Skip to content

Instantly share code, notes, and snippets.

View paulferrett's full-sized avatar

Paul Ferrett paulferrett

  • Melbourne, Australia
View GitHub Profile
@paulferrett
paulferrett / imagick_average_colour.php
Created December 23, 2013 14:40
This function will get the average colour of an image file using PHP and Image Magick using the IMagick extension.
<?php
/**
* Get the average pixel colour from the given file using Image Magick
*
* @param string $filename
* @param bool $as_hex Set to true, the function will return the 6 character HEX value of the colour.
* If false, an array will be returned with r, g, b components.
*/
function get_average_colour($filename, $as_hex_string = true) {
@paulferrett
paulferrett / ism_jobs_api_example.php
Created September 26, 2013 17:16
Simple example for using the Service Central PHP client.
<?php
define('ISM_API_KEY', "your client key");
define('ISM_API_SECRET', "your client secret");
define('ISM_API_TOKEN', "user/client token");
$client = new ISM_Client(ISM_API_KEY, ISM_API_SECRET);
$client->setToken(ISM_API_TOKEN);
$jobs = $client->apis->jobs()->getJobs();
@paulferrett
paulferrett / urlsigning.php
Last active December 25, 2021 14:00
Simple URL signing helper class written in PHP. Use this to generate and verify signed URLs with a shared secret.
<?php
/**
* Url Signing Helper Class
*
* @author Paul Ferrett <paul.ferrett@servicecentral.com.au>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
class UrlSigning {