 |
อัพโหลดภาพไม่ได้ครับ ไฟล์ภาพที่ใช้อัพเป็น .php เรียกแบบ header('Content-type: image/jpeg'); |
|
 |
|
|
 |
 |
|
เขียน code ไว้ยังไงบ้างครับ
|
 |
 |
 |
 |
Date :
2012-02-29 21:17:48 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองเอา header ออกดูก่อนว่ามี error ปนอยู่ไหม
|
 |
 |
 |
 |
Date :
2012-02-29 23:05:02 |
By :
ikikkok |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมหมายถึงใน picture.php นะ
|
 |
 |
 |
 |
Date :
2012-03-01 11:22:31 |
By :
ikikkok |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตามโค้ดนี้ครับ pictures.php
Code
<?php
$text1 = @$_GET['name'];
$text2 = @$_GET['dara'];
$text3 = @$_GET['detail'];
$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);
//---------------------------------------------------------------------------
$font2 = 'DSNSKW_.TTF';
$font_size2 = 45;
$text_bbox2 = imagettfbbox($font_size2, 0, $font2, $text2);
$text_x2 = 250 - round(($text_bbox2[4]/2));
$text_y2 = 155;
$color2 = imagecolorallocate($im, 255, 153, 0);
imagettftext($im, $font_size2, 0, $text_x2, $text_y2, $color2, $font2, $text2);
//---------------------------------------------------------------------------
$font3 = 'DSNSKW_.TTF';
$font_size3 = 30;
$text_bbox3 = imagettfbbox($font_size3, 0, $font3, $text3);
$text_x3 = 250 - round(($text_bbox3[4]/2));
$text_y3 = 485;
$color3 = imagecolorallocate($im, 0, 153, 204);
imagettftext($im, $font_size3, 0, $text_x3, $text_y3, $color3, $font3, $text3);
//---------------------------------------------------------------------------
// Output and free memory
header('Content-type: image/jpeg');
imagejpeg($im);
imagedestroy($im);
?>
|
 |
 |
 |
 |
Date :
2012-03-01 12:35:03 |
By :
lovetummy |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|