Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Remove watermark/link from 9GAG Images
// Got bored/bugged of seeing the watermarks/Link at the bottom of 9GAG images. So wrote this script to remove them
// Eg.
// Very very basic PHP, but gets stuff done!
// Coded while listening to: :D
// USAGE: Put all pics in a 'pics' folder and create an empty 'crop' folder. Run Script. Enjoy. :D
echo "<h6>STARTED</h6>";
foreach(glob('pics/{*.jpg,*.jpeg,*.png}', GLOB_BRACE) as $image)
echo '<p>'.$image;
list($width, $height) = getimagesize($image);
$ext = substr(strrchr($image, '.'), 1);
$cropW = $width;
$cropH = $height-40;
if($ext =='jpeg'||$ext =='jpg')
$origimg = imagecreatefromjpeg($image);
else if ($ext=='png')
$origimg = imagecreatefrompng($image);
$cropimg = imagecreatetruecolor($cropW,$cropH);
// Actual Crop Code
imagecopyresized($cropimg, $origimg, 0, 0, 0, 0, $width, $height, $width, $height);
//Save Cropped Image
if($ext =='jpeg'||$ext =='jpg')
else if ($ext=='png')
echo '-->'.$savefile.'</p>';
echo '<h6>DONE WITH '.$count.' IMAGES</h6>';

This comment has been minimized.

Copy link

@sirinibin sirinibin commented Mar 2, 2017

its not workin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment