Jump to content

Resize image and pad with set colour to fit standard shape


Recommended Posts

For design/content reasons I need to upload a variety of image shapes, resize them and fit the result into a constant sized box with the same fill colour making up the difference. I have written a script to do all the upload and resize depending on whether the width or height is the one that will be the limiting factor. But how do I place that centrally with control over the background colour of the total image? I suspect it is simple but hours of searching have not yielded the answer

Does that background color have to be part of the image? You could just put the image in a DIV with the color. I know it's not what you asked for, but just a thought.

 

EDIT: This should be what you want: http://us.php.net/manual/en/function.imagecopymerge.php

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.