Tag: code

  • BASH: deleting files older than X number of days

    find /path/to/folder -mtime +5 -exec rm -f {} \; A handy utility to stick into the old brain. Thank you, internet, for providing me such a vast and available resource so that I know longer have to rely on my own faculty of memory.

  • PHP: TrueType bounding box with GD

    Just a snippet to print out the values in a bounding box. print_r’s simple outline format just makes it easier to visualize. <?php $im = imagecreatetruecolor(800,600); $arr = imagettfbbox(30,0,’fonts/arial.ttf’,’this is a long string of text!’); print_r($arr); ?>

  • PHP: transparent PNG over JPEG

    <?php header(“Content-type: image/jpeg”); $im = imagecreatetruecolor(800,600); // main image output $im2 = imagecreatefromjpeg(‘image1.jpg’); $im3 = imagecreatefrompng(‘../images/template3.png’); imagecopymerge($im,$im2,360,186,0,0,800,600,100); imagecopy($im,$im3,0,0,0,0,800,600); imagejpeg($im); imagedestroy($im); imagedestroy($im2); imagedestroy($im3); ?>