 |
|
ไฟล์ข้างล่างชื่อ picture.php เวลาที่มีการเรียกไฟล์ picture.php?text1=ทดสอบ&pic=test001.jpg ก็เข้าในเซิร์ฟเวอร์ปกติ คือมีไฟล์ testtest.jpg ในโฟลเดอร์ copy_file แต่เวลาจะเรียกไฟล์ <img src='copy_file/testtest.jpg'> กลับไม่เจอภาพ ไม่ทราบว่าเป็นที่อะไรครับ
picture.php
<?php
$text1 = @$_GET['name'];
$pic = @$_GET['pic'];
// Load the stamp and the photo to apply the watermark to
$stamp = imagecreatefromjpeg('../pictures/'.$pic);
$im = imagecreatefromjpeg('../images/bg.jpg');
// Set the margins for the stamp and get the height/width of the stamp image
$marge_right = 71;
$marge_bottom = 64;
$sx = imagesx($stamp);
$sy = imagesy($stamp);
// Copy the stamp image onto our photo using the margin offsets and the photo
// width to calculate positioning of the stamp.
imagecopy($im, $stamp, imagesx($im) - $sx - $marge_right, imagesy($im) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp));
//---------------------------------------------------------------------------
$font1 = 'DSNSKW_.TTF';
$font_size1 = 25;
$text_bbox1 = imagettfbbox($font_size1, 0, $font1, $text1);
$text_x1 = 250 - round(($text_bbox1[4]/2));
$text_y1 = 30;
$color1 = imagecolorallocate($im, 255, 21, 255);
imagettftext($im, $font_size1, 0, $text_x1, $text_y1, $color1, $font1, $text1);
//---------------------------------------------------------------------------
// Output and free memory
header('Content-type: image/jpeg');
imagejpeg($im);
$f_path = 'copy_file/testest.jpg';
imagejpeg($im, $f_path);
imagedestroy($im);
?>
Tag : PHP, HTML/CSS, JavaScript, Ajax
|
|
 |
 |
 |
 |
Date :
2012-03-03 19:30:46 |
By :
lovetummy |
View :
1236 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |