رفتن به مطلب

کد ادغام 3 عکس png به یک عکس با php


پست های پیشنهاد شده

با سلام

دوستان میتونن کمک کنن که چطور میتونم با کدهای php سه تا عکس ترنسپرنت رو با php به یک عکس تبدیل کنم و توی هاست ذخیره کنم .

هر کدی استفاده کردم جواب نداد . کتابخونه ی gd هم نصبه .

مثلا این سه تا عکس 200*200 به عنوان مثال :

logo-black-circle.png200px-Ski_jumping_pictogram.svg.pngwater_splash_png_by_starlaa1-d51fss5.png

لینک به ارسال

این از کد مشابهش:


<?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);

و اینم توضیج بخش اصلیش:


http://php.net/manual/en/function.imagecopymerge

ویرایش شده توسط Anisi
  • امتیاز 1
لینک به ارسال

این از کد مشابهش:


<?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);

و اینم توضیج بخش اصلیش:


http://php.net/manual/en/function.imagecopymerge

تشکر اما جواب نداد ببنید کد رو اشتباه استفاده کردم :


$a3='ss.png';
$a4='bb.png';
$image = imagecreatefrompng($a3);
$frame = imagecreatefrompng($a4);
imagecopymerge($image, $frame, 0, 0, 0, 0, 50, 50, 100);
# Save the image to a file
imagepng($image, 'image.png');
# Output straight to the browser.
imagepng($image);

خروجیش شد فقط عکس دوم با زمینه ی سیاه

و یه سوال این اعداد 50 و 100 و 0 چی هستن ؟ باید ابعاد و میزان شفافیت و مکان باشهدرسته اما من نمیدونم دقیق کدوم هستن

ممنون میشم راهنمایم کنید

لینک به ارسال

لطفا برای ارسال دیدگاه وارد شوید

شما بعد از اینکه وارد حساب کاربری خود شدید می توانید دیدگاهی ارسال کنید



ورود به حساب کاربری
×
×
  • اضافه کردن...