Solved

using php want to add whitespace to bottom of image

Posted on 2010-08-12
4
407 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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.

685 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