Solved

using php want to add whitespace to bottom of image

Posted on 2010-08-12
4
395 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
  • 2
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
pironic earned 500 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
 
LVL 2

Expert Comment

by:pironic
ID: 33421282
0
 

Author Comment

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

Author Closing Comment

by:rgb192
ID: 33432508
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Integrate Office 365 calendar events into WordPress sites 2 53
php date - compare 4 40
simplest php form 3 59
myqsl update statement on phpMyAdmin 8 21
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
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…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

911 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now