[ bane @ 26.10.2018. 11:53 ] @
| <?php
$image = imagecreatefromjpeg("button.jpg");
$color = imagecolorallocate($image, 0, 0, 0);
imagettftext($image, 5, 0, 250, 250, $color, "C:/Windows/Fonts/Arial", "This is the text");
header("Content-Type: image/jpeg");
imagejpeg($image);
///////////////////////////////////////////////////////////
Jednostavno ne upload-uje sliku. Ovo je primer iz Programming PHP
Ako izuzmen
imagettftext($image, 5, 0, 250, 250, $color, "C:/Windows/Fonts/Arial", "This is the text");
slika se učitava, a kada uključim ovu funkciju nemogu da je uploadujem preko
<img src="button2.php?text=<?= urlencode("PHP Button"); ?>" /> |
[ Predrag Supurovic @ 26.10.2018. 13:17 ] @
Možda ti putanja do dattoeke fotna nije ispravna?
STavi
header("Content-Type: image/jpeg");
imagejpeg($image);
Pod komentar pa će ti verovatno prikazati neku grešku.
[ bane @ 26.10.2018. 13:23 ] @
Hvala na javljanju, na kraju sam rešio problem:
//////////////////////////////////////////////////////
<?php
$image = imagecreatefrompng("button.png");
$text = isset($_GET['text']) ? $_GET['text'] : '';
$path = "C:/xampp/htdocs/Programming PHP/Graphics"; // button cache directory
$color = imagecolorallocate($image, 0, 0, 0);
imagettftext($image, 20, 0, 150, 100, $color, "C:/Windows/Fonts/Arial.ttf", $text);
header("Content-Type: image/png");
imagepng($image);
Copyright (C) 2001-2025 by www.elitesecurity.org. All rights reserved.