resimin içine yazı yazmak

0
Onaylı Üye
Üye
Katılım
16 Ocak 2005
Mesajlar
670
Tepki puanı
0
Konum
Suisse
merhaba
kullandığım scriptte değişiklik yapmak istiyorum resim gösterilirken içine yazı yazmak istiyorum...
<img src="view2.php?picture=<?=$line[picture];?>&i=3" border="0">
resim yukarıdaki url de görüntüleniyor
Aşağıdaki örneği üstteki url ye nasıl uyarlayabilirim
<?php
// Set the content-type
header("Content-type: image/png");

// Create the image
$im = imagecreatetruecolor(400, 30);

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $white);

// The text to draw
$text = 'merhaba!';
// Replace path by your own font path
$font = 'arial.ttf';

// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);

// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);

// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>
sorunu halletmeme yardım edecek kişiye 1 .info domain benden :)
ufak bir armagan..
teşekkürler
 
0
Onaylı Üye
Üye
Katılım
12 Aralık 2004
Mesajlar
9,603
Tepki puanı
106
Konum
AZ
$line[picture] diye cagirilan ne, resimin bulundugu dizinin yolu ve dosya ismi mi? Eger oyleyse

$im = imagecreatetruecolor(400, 30);

Yazan yerde,

$im = imagecreatefromjpeg($line[picture]);

diyerek kaynak resimi elindeki resimden olusturtabilirsin. URL'nin bu kadarindan anlamak zor.
 
0
Onaylı Üye
Üye
Katılım
16 Ocak 2005
Mesajlar
670
Tepki puanı
0
Konum
Suisse
merhaba söylediginizi uyguladim ama hata verdi;

Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/pro/public_html/mevcut.php on line 171
 
0
Onaylı Üye
Üye
Katılım
16 Ocak 2005
Mesajlar
670
Tepki puanı
0
Konum
Suisse
merhaba kod asagidadir (viev2.php)
<?
$resim = "/pictures/".$picture;
include "duzenle.php";


$thumb=new thumbnail("$resim");
$size = getimagesize("$resim");
$width= $size[0];
$height= $size[1];


if($i == "1"){
$max_width= "120";
if ($width>$max_width){
$thumb->size_width(120);
}else{
$thumb->size_width($width);
$thumb->size_height($height);
}
}
if($i == "2"){
$max_width = "400";
if ($width>$max_width){
$thumb->size_width(400);
}else{
$thumb->size_width($width);
$thumb->size_height($height);
}
}
if($i == "3"){
$max_width = "150";
if ($width>$max_width){
$thumb->size_width(150);
}else{
$thumb->size_width($width);
$thumb->size_height($height);
}
}
if($i == ""){

$thumb->size_width($width);
$thumb->size_height($height);

}



$thumb->jpeg_quality(70);
$thumb->show();
?>
 
0
Onaylı Üye
Üye
Katılım
12 Aralık 2004
Mesajlar
9,603
Tepki puanı
106
Konum
AZ
Fonksiyonlarla baska dosyalara bagliymis gerci ama yine de birseyler yapmaya calistim, bilmeden ancak bu kadar. Calismassa kizma :)

Araya girdigim yere buyuk harflerle aciklama yazdim. Baska bir isimle kaydedip test et.

PHP:
<?
$resim = "/pictures/".$picture;
include "duzenle.php";

// RESIM DEGISKENI OLARAK ALINAN RESIM DOSYASINA
// YAZI YAZDIRACAGIZ 
//
// EK BASLA


$im = imagecreatefromjpeg($resim);
// RESIM JPEG DEGILSE 
// imagecreatefromgif,  imagecreatefrompng gibi fonksiyonlar kullanilmali

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $white);

// The text to draw
$text = 'merhaba!';
// Replace path by your own font path
$font = 'arial.ttf';

// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);

// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);


imagejpeg($im,$resim,70);



// EK BITIR

$thumb=new thumbnail("$resim");
$size = getimagesize("$resim");
$width= $size[0];
$height= $size[1];


if($i == "1"){
$max_width= "120";
if ($width>$max_width){
$thumb->size_width(120);
}else{
$thumb->size_width($width);
$thumb->size_height($height);
}
}
if($i == "2"){
$max_width = "400";
if ($width>$max_width){
$thumb->size_width(400);
}else{
$thumb->size_width($width);
$thumb->size_height($height);
}
}
if($i == "3"){
$max_width = "150";
if ($width>$max_width){
$thumb->size_width(150);
}else{
$thumb->size_width($width);
$thumb->size_height($height);
}
}
if($i == ""){

$thumb->size_width($width);
$thumb->size_height($height);

}



$thumb->jpeg_quality(70);
$thumb->show();
?>
 
0
Onaylı Üye
Üye
Katılım
16 Ocak 2005
Mesajlar
670
Tepki puanı
0
Konum
Suisse
gerçekten çok teşekkürler hemen deniyorum domain için pm atınız
 
Geri
Üst