Note that there are some explanatory texts on larger screens.

plurals
  1. POHow correctly to put text on an image?
    text
    copied!<p>Good day.</p> <p><strong>First add all images in one:</strong></p> <pre><code>$dst_r = ImageCreateTrueColor( $targ_w, $targ_h ); imagecopyresampled($dst_r,$img_r1,$x1,$y1,0,0,$ww1,$hh1,$w1,$h1); imagecopyresampled($dst_r,$img_r2,$x2,$y2,0,0,$ww2,$hh2,$w2,$h2); imagecopyresampled($dst_r,$img_r3,$x3,$y3,0,0,$ww3,$hh3,$w3,$h3); imagecopyresampled($dst_r,$img_r4,$x4,$y4,0,0,$ww4,$hh4,$w4,$h4); imagecopyresampled($dst_r,$img_r5,$x5,$y5,0,0,$ww5,$hh5,$w5,$h5); imagecopyresampled($dst_r,$img_r6,$x6,$y6,0,0,$ww6,$hh6,$w6,$h6); imagecopyresampled($dst_r,$img_r7,$x7,$y7,0,0,$ww7,$hh7,$w7,$h7); imagecopyresampled($dst_r,$img_r8,$x8,$y8,0,0,$ww8,$hh8,$w8,$h8); imagecopyresampled($dst_r,$img_r9,$x9,$y9,0,0,$ww9,$hh9,$w9,$h9); imagecopyresampled($dst_r,$img_r0,$x0,$y0,0,0,$w0,$h0,$w0,$h0); </code></pre> <p><strong>In result we get image:</strong> <img src="https://i.stack.imgur.com/rIAps.jpg" alt="ssde"></p> <p><strong>Next step - add text on image:</strong></p> <pre><code>$font = 'calibri_bold_italic.ttf'; $black = imagecolorallocate($dst_r, 255, 255, 255); $bbox = imageftbbox(42, 0, $font, $text); $text_x = (imagesx($dst_r) - $bbox[4])/2; $text_y = 70;//(imagesy($dst_r) - $bbox[5])/2; imagefttext($dst_r, 42, 0, $text_x, $text_y, $black, $font, $text); </code></pre> <p><strong>But in step two result we get image:</strong></p> <p><img src="https://i.stack.imgur.com/tvrLm.jpg" alt="vvv"></p> <p><strong><em>As we can see - bottom of the picture have empty strip.</em></strong></p> <p><em>Tell me plasse where eeror?</em> </p> <p><em>Why i get empty strip on bottom image and how delete her ?</em></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload