add a stripe on an image

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I've an image that is 300x225 pixels.
I've to send this image to mobile phones using the mms. For this the best  
result is given using 120x160 pixels.
So I may generate a 120 pixels large image, but I've a lot of unused space  
under the image, as scaling proportionally, my image is then 120x90.

how to enlarge the image in order to get the picture 120x90 and then a white  
stripe where I may write the website (or put the logo).

The resulting image should be 120x160, 120x90 used by the picture, 120x70 a  
white stripe where I may put the logo or a text.



Re: add a stripe on an image

Bob Bedford wrote:
Quoted text here. Click to load it

1. Create a blank 120x160 image with imagecreate().
2. Open the existing 120x90 image with imagecreatefromX().
3. Copy the existing 120x90 image opened in Step 2 into
   the blank image created in Step 1 with imagecopy().
4. Output the newly generated 120x160 image with imageX().

X, of course, stands for the image type (gif, jpeg, png, etc.)


Re: add a stripe on an image

Bob Bedford wrote:

Quoted text here. Click to load it

Hi Bob,

Start reading here:

It boils down to:
1) Make sure you have GD2-support on your PHP-machine. Check via phpinfo()

2) Open the image (from file eg) with functions like imagecreatefromgif or  
imagecreatefromjpg, etc. You can look them up, I don't know your format.

3) Resample your image (resampling is better than resizing) and copy it to  
another slightly larger image you first create.  
Look at functions like imagecopyresampled()

4) write your text under it.

Good luck.

Erwin Moller

Site Timeline