View Full Version : Framing An Image Possible With PHP?

03-13-2010, 05:37 PM
What I would like to make is a script that can download a photo from a URL and add a custom frame to it.

The idea is for a Facebook application that I want to make where people can choose a frame and then it will output a single image file that they can choose to set as their profile picture.

Is it possible to do something like this easily?

03-13-2010, 05:46 PM
Easily? Depends on your PHP knowledge and what platform your serving on. I did something awhile back that dynamically made a signature from text the user input into a final image using a preset background.

It's the same concept. But you would need to have a few PNG borders on the server to choose from then run the script and just place the border over the image.

I mean there is GD and ImageMagick for image manipulation. Then PHP has it's own functions for imaging, like imagecreate and ImageColorAllocate and imagettfbbox basic ones but there are more.

I'm running out the house right now so don't have time to write something up but a quick search on google for "php combine two images" rendered this:

Overlaping images with GD (http://www.codewalkers.com/c/a/Miscellaneous/Overlapping-Images-with-GD/)

Just what I was talking about. Real easy to do and quick. So make your premade borders in PNG with transparent backgrounds then just run that on server side to combine.

PHP even has one for this:

imagecopy (http://php.net/manual/en/function.imagecopy.php)

Enjoy, just play it can't hurt.