 |
PHP - การสร้างรูปภาพโดยเอารูป 2 รูปเอามา Merge รวมอยู่ในรูปเดียว |
|
 |
|
|
 |
 |
|
Code (PHP)
<?php
header ("Content-type: image/png");
$imgpng = imagecreatefrompng("image/รูป.png");
$imgframe = imagecreatefrompng("image/รูป.png");
$img = @imagecreate(100, 71);
imagecopy($img,$imgframe,0,0,0,0,100,100);
imagecopy($img,$imgpng,15,15,10,10,70,70);
imagepng($img);
imagedestroy($img);
imagedestroy($imgpng);
?>
คือผมใช้ฟังก์ชั่นนี้แล้วรูปมันแตก ทำไงถึงจะทำให้รูปมันชัดนะครับ
Tag : PHP
|
|
 |
 |
 |
 |
Date :
2013-09-19 16:26:13 |
By :
kidkitty007 |
View :
1772 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองดูแบบนี้ครับ
Code (PHP)
<?php
// Create image instances
$dest = imagecreatefromgif('php.gif');
$src = imagecreatefromgif('php.gif');
// Copy and merge
imagecopymerge($dest, $src, 10, 10, 0, 0, 100, 47, 75);
// Output and free from memory
header('Content-Type: image/gif');
imagegif($dest);
imagedestroy($dest);
imagedestroy($src);
?>
|
 |
 |
 |
 |
Date :
2013-09-20 06:08:28 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?php
# If you don't know the type of image you are using as your originals.
$image = imagecreatefromstring(file_get_contents($your_original_image);
$frame = imagecreatefromstring(file_get_contents($your_frame_image));
# If you know your originals are of type PNG.
$image = imagecreatefrompng($your_original_image);
$frame = imagecreatefrompng($your_frame_image);
imagecopymerge($image, $frame, 0, 0, 0, 0, 50, 50, 100);
# Save the image to a file
imagepng($image, '/path/to/save/image.png');
# Output straight to the browser.
imagepng($image);
?>
Code (PHP)
<?php
$dest = imagecreatefrompng('vinyl.png');
$src = imagecreatefromjpeg('cover2.jpg');
imagealphablending($dest, false);
imagesavealpha($dest, true);
imagecopymerge($dest, $src, 10, 9, 0, 0, 181, 180, 100); //have to play with these numbers for it to work for you, etc.
header('Content-Type: image/png');
imagepng($dest);
imagedestroy($dest);
imagedestroy($src);
?>
ไม่แน่ใจว่าตัวไหนชัดกกว่ากัน
|
 |
 |
 |
 |
Date :
2013-09-20 06:08:58 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|