-
-
Save anonymous/dcf3c1859f797fb9a592 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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