metin görüntüleme değil

1 Cevap php
<?php

header ("Content-type: image/pjpeg");
$string = "manujagadeesh!!!";                                             
$font  =8;
$width  = ImageFontWidth($font)* strlen($string) ;
$height = ImageFontHeight($font) ;

$im = ImageCreateFromjpeg("sachin.jpg");
$x=100;
$y=200;
$background_color = imagecolorallocate ($im, 255, 255, 255); //white background
$text_color = imagecolorallocate ($im, 0, 0,0);//black text
imagestring ($im, $font, $x, $y,  $string, $text_color);
imagejpeg ($im);
?>

Bu php görüntü eklenti metin

wen metnini gösteren değil inclue benim HTML sayfası

eg

<?php

header ("Content-type: image/pjpeg");
$string = "manujagadeesh!!!";                                             
$font  =8;
$width  = ImageFontWidth($font)* strlen($string) ;
$height = ImageFontHeight($font) ;

$im = ImageCreateFromjpeg("sachin.jpg");
$x=100;
$y=200;
$background_color = imagecolorallocate ($im, 255, 255, 255); //white background
$text_color = imagecolorallocate ($im, 0, 0,0);//black text
imagestring ($im, $font, $x, $y,  $string, $text_color);
imagejpeg ($im);
?>

hi welcome

merhaba wlecome göremiyordu

1 Cevap

Çıktı türü hem içeriğini olamaz image/jpeg ve text/html Aynı PHP script. Başka bir dosya örneğin stringImage.php için görüntü oluşturma kodu taşımak ve bunu eklemek için aşağıdaki kodu kullanabilirsiniz:

<img src="stringImage.php" />
hi welcome

Sürece stringImage.php sadece doğru içerik türü, ve başka bir şey ile görüntü verilerini verir gibi, size beklenen sonucu almak gerekir.