Jump to content
php.lv forumi

image watermarks


Jackal

Recommended Posts

<?

Kāpēc šāds kods strādā, tas ir parāda bildi ar watermarku

 

header('content-type: image/jpeg');

 

$watermark = imagecreatefrompng('watermark.png');

$watermark_width = imagesx($watermark);

$watermark_height = imagesy($watermark);

$image = imagecreatetruecolor($watermark_width, $watermark_height);

$image = imagecreatefromjpeg($_GET['src']);

$size = getimagesize($_GET['src']);

$dest_x = 0 + 1;

$dest_y = $size[1] - $watermark_height - 1;

imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100);

imagejpeg($image);

imagedestroy($image);

imagedestroy($watermark);

?>

 

bet šāds kods parāda tikai linku uz bildi?

 

header('content-type: image/jpeg');

 

function connect(){

$savienojums=mysql_connect("localhost","********","*********") or die ("Unable connect to server!");

mysql_select_db("datubaze",$savienojums) or die ("Unable connect to database!");

}

connect();

$now = date('Y-m-d H:i:s');

$kom = mysql_query("SELECT aaa FROM users WHERE aaa = '$now'");

$row = mysql_fetch_array($kom);

$laiks = date('H:i', strtotime($row['aaa']));

$skaits = mysql_num_rows(mysql_query("SELECT aaa FROM users WHERE aaa = '$now'"));

 

$watermark = imagecreatefrompng('watermark.png');

$watermark_width = imagesx($watermark);

$watermark_height = imagesy($watermark);

$image = imagecreatetruecolor($watermark_width, $watermark_height);

$image = imagecreatefromjpeg($_GET['src']);

$size = getimagesize($_GET['src']);

$dest_x = 0 + 1;

$dest_y = $size[1] - $watermark_height - 1;

imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100);

imagejpeg($image);

imagedestroy($image);

imagedestroy($watermark);

?>

 

Kā šo kļūdu varētu labot? Abi kodi atsevišķi stādā.

Edited by Jackal
Link to comment
Share on other sites

×
×
  • Create New...