İki Resmi Alt Alta Birleştirme (PHP)
-
Birleştiriyorum fakat altta boşluk çıkıyor, nedenini hala anlamış değilim.
2. problemde arkaplanın beyaz olması.
**
İşin aslı : eklediğim resimlerin altına site linki atacağım. Logom var ve resimler var. Ekliyorum da sıkıntı çıkıyor. Kod ;
edit: tek sıkıntı şu logo kısmının siyah kalması, beyaz olması gerenk :| diğerini hallettim
şöyle görünüyor

<?php function merge($filename_x, $filename_y, $filename_result) { list($width_x, $height_x) = getimagesize($filename_x); list($width_y, $height_y) = getimagesize($filename_y); $image = imagecreatetruecolor($width_x, $height_y + $height_x); $image_x = imagecreatefromjpeg($filename_x); $image_y = imagecreatefrompng($filename_y); imagecopy($image, $image_x, 0, 0, 0, 0, $width_x, $height_x); imagecopy($image, $image_y, 0, $height_x, 0, 0, $width_y, $height_y); imagejpeg($image, $filename_result); imagedestroy($image); imagedestroy($image_x); imagedestroy($image_y); } merge('image.jpg', 'simge.png', 'merged.jpg'); -
Tamam çözdüm millet. İsteyen olursa ;
<?php function merge($filename_x, $filename_y, $filename_result) { list($width_x, $height_x) = getimagesize($filename_x); list($width_y, $height_y) = getimagesize($filename_y); $image = imagecreatetruecolor($width_x, $height_y + $height_x); $image_x = imagecreatefromjpeg($filename_x); $image_y = imagecreatefrompng($filename_y); $white = imagecolorallocate($image, 255, 255, 255); imagefill($image, 0, 0, $white); imagecopy($image, $image_x, 0, 0, 0, 0, $width_x, $height_x); imagecopy($image, $image_y, 0, $height_x, 0, 0, $width_y, $height_y); imagejpeg($image, $filename_result); imagedestroy($image); imagedestroy($image_x); imagedestroy($image_y); } merge('image.jpg', 'simge.png', 'merged.jpg');Yalnız gif, png, jpg falan için farklı şeyler yapmanız gerek. Uzantıyı çekip siwtch yada if-else ile imagecreatefromjpg kısmını ayarlayabilirsiniz.
-
https://www.google.com/#q=how+to+watermark+with+php
Toplam Hit: 1356 Toplam Mesaj: 3
