PHP: Add text in a filled rectangular box to the bottom of a goddamn image
July 6, 2008 – 8:08 pmHoly shit, why did this take so long to figure out.
$input_filename = 'somefile.jpg'; $output_file = 'someotherfile.jpg'; $new = ImageCreateFromjpeg($input_filename); $width = imagesx($new); $height = imagesy($new); $black = imagecolorallocate($new, 0, 0, 0); $white = imagecolorallocate($new, 255, 255, 255); $font = 4; imagefilledrectangle($new, 0, ($height-20) , $width, $height, $black); imagestring($new, $font, $leftTextPos, $height-18, $name, $white); imagejpeg($new, $output_filename);

Sorry, comments for this entry are closed at this time.