Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

using php want to add whitespace to bottom of image

Posted on 2010-08-12
4
Medium Priority
?
435 Views
Last Modified: 2012-05-10
current image is 300x300

add
100 pixel width
100 height

whitespace to an image

I want the whitespace to be at the bottom right of the image
0
Comment
Question by:rgb192
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
pironic earned 2000 total points
ID: 33421235
here is the working code for this... i've used imagecreatefrompng, but you can use imagecreatefromgif or jpeg if you want too.
<?php 

header('content-type: image/jpeg');  

$orig = imagecreatefrompng("http://".$_GET['src']);  
$orig_width = imagesx($orig);  
$orig_height = imagesy($orig);  
$image = imagecreatetruecolor($orig_width+100, $orig_height+100);  
$white = imagecolorallocate($image, 255, 255, 255);
imagefill($image, 0, 0, $white);
imagecopymerge($image, $orig, 0, 0, 0, 0, $orig_width, $orig_height, 100);  
imagejpeg($image);  
imagedestroy($image);  
imagedestroy($orig);  

?>

Open in new window

0
 

Author Comment

by:rgb192
ID: 33432393
does not save the new image
0
 

Author Closing Comment

by:rgb192
ID: 33432508
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question