Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

using php want to add whitespace to bottom of image

Posted on 2010-08-12
4
Medium Priority
?
443 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 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

885 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