Skip to content

Instantly share code, notes, and snippets.

/**
* Very simple way to check if a file exists on this domain.
* Use with the jQuery library.
*
* Important: Works only on the same domain.
* Cross-domain-requests have to be done in another way (see JSONP)!
*
* Use: console.log( "/data/list.json".fileExists() );
*/
String.prototype.fileExists = function() {
<?php
//error_reporting(E_ERROR);
$original = imagecreatefrompng("assets/picture.png");
$mask = imagecreatefrompng("assets/mask.png");
$masked = applyAlphaMask( $original, $mask );
function applyAlphaMask($image, $mask) {