| Autor | Zpráva | ||
|---|---|---|---|
| fosil Profil * |
#1 · Zasláno: 28. 6. 2013, 13:28:53
Řešil jsem problém s obrázkem, který se úspěšně vyřešil, ale mám ještě jeden problém a to je zrušit pozadí u textu. Snažím se stím hrát, ale vždy jen změním barvu nebo udělám nějakou chybu. Nevíte někdo co tam mám přidat nebo upravit? Hledal jsem na internetu, ale nic jsem nenašel. Děkuju
<?php
header("Content-type: image/jpeg");
$img_src = imagecreatefromjpeg($_SERVER['DOCUMENT_ROOT'].'/img/fotoalbum/12.jpg');
$width_src = imagesx($img_src);
$height_src = imagesy($img_src);
$width_dst = $width_src;
$height_dst = $height_src;
$quality = 80;
$img = imagecreatetruecolor($width_src, $height_dst);
imagecopyresampled($img, $img_src, 0, 0, 0, 0, $width_dst, $height_dst, $width_src, $height_src);
$x1_rect = 0;
$y1_rect = $height_dst - 30;
$x2_rect = $width_dst;
$y2_rect = $height_dst;
$color = imagecolorallocate($img, 245, 245, 245);
$letter_color = imagecolorallocate($img, 140, 140, 140);
$text = "Naše miss";
imagefilledrectangle($img, $x1_rect, $y1_rect, $x2_rect, $y2_rect, $color);
imagettftext($img, 20, 0, $x1_rect+5, $y1_rect+22, $letter_color, $_SERVER['DOCUMENT_ROOT'].'/font/out.ttf', $text);
imagejpeg($img, '', $quality);
imagedestroy($img_src);
imagedestroy($img);
?> |
||
| Joker Profil |
#2 · Zasláno: 28. 6. 2013, 13:50:13
fosil:
Jestli to dobře chápu, jde o to, aby místo té barvy na pozadí tam byla průhledná barva? Průhledná barva se dělá přes alfu, místo imagecolorallocate se použije imagecolorallocatealpha. |
||
| fosil Profil * |
#3 · Zasláno: 28. 6. 2013, 13:59:54
Super, děkuju moc. Pěkně to funguje.
|
||
|
Časová prodleva: 13 let
|
|||
0