Skip to content

Instantly share code, notes, and snippets.

/bicapsize.php Secret

Created November 3, 2013 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/dcf3c1859f797fb9a592 to your computer and use it in GitHub Desktop.
Save anonymous/dcf3c1859f797fb9a592 to your computer and use it in GitHub Desktop.
<?php
$directory = "btsync/cumstuff/tumblr";
$files = glob("{$directory}/to-be-prepped/*.jpg");
foreach($files as $file)
{
$parts = pathinfo($file);
$filename = $parts["filename"] . "." . $parts["extension"];
echo "Parsing {$filename}\n";
$image = imagecreatefromjpeg($file);
$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
$width = imagesx($image);
$height = imagesy($image);
if($width > 900 || $height > 900)
{
if($width > $height)
$percent = 900 / $width;
else
$percent = 900 / $height;
}
else
$percent = 1;
$newwidth = $width * $percent;
$newheight = $height * $percent;
$newimage = imagecreatetruecolor($newwidth, $newheight);
imagecopyresized($newimage, $image, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
$image = $newimage;
$width = imagesx($image);
$height = imagesy($image);
imagefilter($image, IMG_FILTER_BRIGHTNESS, -50);
imagefilter($image, IMG_FILTER_CONTRAST, 10);
imagettftext($image, 24, 0, 10, $height - 10, $white, "./SpecialElite.ttf", "bi-caps.com");
imagejpeg($image, "{$directory}/to-be-capped/{$filename}");
imagedestroy($image);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment