3

In a laptop mockup or a phone mockup or others any kind of mockup, I want to insert an external image is there any script PHP or javascript like my idea? I already found some site are doing same. How do I build it? Can anyone give me some idea?

My example site is http://magicmockups.com/mockup/10/

  • That link does not work. I have some Imagemagick bash unix shell scripts that will put images onto t-shirts and coffee mugs and have put images onto cell phones. See my scripts, tshirt and cylinderize, for example at http://www.fmwconcepts.com/imagemagick/index.php. For commercial use, they would need to be licensed. They can be run from PHP exec() commands. You would have to build the web user interface. – fmw42 Aug 30 '18 at 17:44
  • I think I am not searching this script. Just update the link. – Khandaker Ikrama Aug 31 '18 at 14:22

2 Answers2

4

You can use Imagemagick's perspective distortion after you measure the corners in both images.

Background:

enter image description here

Image:

enter image description here

Command (Unix syntax):

convert background.png \
\( monet2.jpg -virtual-pixel none +distort perspective "0,0 317,99  265,0 540,85  265,333 594,426  0,333 342,446" \) \
-layers merge +repage monet2_background.jpg


If on Windows, remove the \ before ( and before ) and change the end of line \ to ^.

Result: enter image description here

You can run this from PHP exec() or recode it in PHP Imagick syntax.

fmw42
  • 46,825
  • 10
  • 62
  • 80
-1

You can use PHP image processing libraries such as PHP GD or ImageMagick.