Jackal Posted October 31, 2006 Report Share Posted October 31, 2006 (edited) <? 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 October 31, 2006 by Jackal Link to comment Share on other sites More sharing options...
bubu Posted October 31, 2006 Report Share Posted October 31, 2006 Neredzu atšķirību starp kodiem bildes ģenerēšanai.. Kā tas jāsaprot "parāda tikai linku uz bildi"? Link to comment Share on other sites More sharing options...
Jackal Posted October 31, 2006 Author Report Share Posted October 31, 2006 (edited) Nu tur jau tā lieta, es ar nesaprotui kā tas var būt, jo kods nav mainīts? Bildes vietā parādās links: http://localhost/aaa.php?src=2.jpg Edited October 31, 2006 by Jackal Link to comment Share on other sites More sharing options...
bubu Posted October 31, 2006 Report Share Posted October 31, 2006 Neredzu nevienu echo ar "<a href=.." šajā kodā, lai pateiktu kāpēc tev izvādās kautkāds mistisks links. Link to comment Share on other sites More sharing options...
Orion7 Posted November 2, 2006 Report Share Posted November 2, 2006 Laikam tajā lapā, kur bildei ir jāparādās, <img src=... vietā ir <a href=... Link to comment Share on other sites More sharing options...
Recommended Posts