-1

I am looking to create a Product customisation tool in PHP. This tool will allow the user to create his own Customization to a predefined Mobile cover. I already have a Mobile cover image and I am looking to allow a user to write his name under a background colour on the Mobile cover image. User can change the font size and style for his name.

I am not sure how to proceed ahead with it. I am looking to dynamically create image that is placed on the Mobile cover in such way that it looks its part.

I am looking for way on how to approach it and which php image handling libraries should I make use of .

Help would be greatly appreciated.

Mohit Dhiman

  • You can use ImageMagick using PHPs iMagick-extension for that. See http://stackoverflow.com/a/6022355/156481 – acme Jul 29 '13 at 15:01
  • See [Image Processing and Generation](http://www.php.net/manual/en/refs.utilspec.image.php). Most people seem to use GD or ImageMagick – Herbert Jul 29 '13 at 15:04

2 Answers2

1

In my opinion you would be better using Ajax but with the image manipulation tool Imagick. However a downfall is this could potentially be very slow and also could use alot of CPU usage if your generating on the fly. Alother solution is you maybe able to find some flash product editors out there that all ready have this in built function, the only downside been the browser compatability issue with mobile devices.

I think the best way would be to have a template image and an ajax enabled upload function that inputs that image onto a canvas (maybe html5) and then use a dragable html5 or jquery canvas and track the x and y axis on the image:

here are some maybe useful links:

http://jqueryui.com/draggable/ - jquery dragable

http://www.w3schools.com/html/html5_draganddrop.asp - dragable canvas

Drawing Uploaded Image(with Ajax) to Canvas - drawing uploaded image to canvas

Imagick php - http://php.net/manual/en/class.imagick.php

Community
  • 1
  • 1
Liam Sorsby
  • 2,912
  • 3
  • 28
  • 51
  • Just out of curiousity, where did that 72 dpi come from? Do you have a link? I've heard that before but can't find an official reference. – Herbert Jul 29 '13 at 15:16
  • this is from previous usage but it you look at http://php.net/manual/en/function.imagejpeg.php you maybe able to change the DPI now. http://php.net/manual/en/function.imagejpeg.php – Liam Sorsby Jul 29 '13 at 15:25
  • I don't think GD affects image resolution. As this [Stack Overflow answer to an unrelated question](http://stackoverflow.com/a/4754645/911182) points out, _"DPI doesn't exist in digital. There are only pixels..."_ Certainly, one can set JPEG's quality factor, but that doesn't have anything to do resolution. Regardless, I wouldn't recommend JPEG for print anyway. – Herbert Jul 29 '13 at 15:33
  • Yeah i think your right i will remove the bit about DPI however i would still recomend imagick as it has a lot more functionality then php's own GD. – Liam Sorsby Jul 29 '13 at 15:40
0

You can create a draw.php file . this file will get some query strings like backgroundcolor, text etc. and draw an image with this datas.

Now when user change backgroundcolor, you will make an ajax call to draw.php?backgroundcolor=BLABLA&text=SOMETEXT... and you can display result on your page.

First learn have to draw images with php and than learn making ajax calls. After these, you can ask again.

Eray
  • 7,038
  • 16
  • 70
  • 120