By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,314 Members | 1,793 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,314 IT Pros & Developers. It's quick & easy.

image manipulation...help needed

P: n/a
i have this situation. i have a query string:

http://www.myquerystring.com?x=xxxxx

what this url does is it will return or start downloading a .png file.
what i wanted to do is trap this png file and manipuate the image like
resizing, color...etc. how can i do this?

Jun 21 '07 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Rik
On Thu, 21 Jun 2007 09:01:43 +0200, shotokan99 <so**********@yahoo.com
wrote:
i have this situation. i have a query string:

http://www.myquerystring.com?x=xxxxx

what this url does is it will return or start downloading a .png file.
what i wanted to do is trap this png file and manipuate the image like
resizing, color...etc. how can i do this?
If allow_url_fopen is enabled you should be able to retrieve & alter it
using the GD functions.
--
Rik Wasmus
Jun 21 '07 #2

P: n/a
allow_url_fopen is close but i can use curl. how to do it?

Jun 21 '07 #3

P: n/a
how to do that with gd?

Jun 21 '07 #4

P: n/a
shotokan99 <so**********@yahoo.comwrote in news:1182412374.565889.283240
@o11g2000prd.googlegroups.com:
how to do that with gd?
try this, which i found after 0.9 seconds of googling:

http://www.scripts.com/php-scripts/i...pts/php-image-
manipulation-class-103/

http://www.scripts.com/php-scripts/i...ation-scripts/

Jun 21 '07 #5

P: n/a
Are you looking to modify the PNG on the server
or the client within the browser ?

If you want to modify Server side then look at the GD library. Here
are two good links for that
www.libgd.org/Main_Page
- GD - Open Source library
http://www.codebeach.com/index.asp?t...ubcategoryID=4
- GD Tutorials

If you want to modify within the browser you might
consider use of an ActiveX component like our own
MetaDraw 3 OCX ( see www.Bennet-Tec.com) , or ImageMan ( from
DataTechniques www.Data-Tech.com ).
* MetaDraw will allow resizing, drawing / annotation, ..
by client side script or even ( if you allow ) by the
end-user with his mouse within the browser. * ImageMan
is great for things like Resizing, Rotation, Color depth
manipulation, Gamma correction, ...

* * Please include a copy of this message with your reply

-----
Jeff Bennett
Je**@Bennet-Tec.Com
* Bennet-Tec Information Systems, Inc
* 50 Jericho Tpk, Jericho, NY 11753
* Phone 516 997 5596, Fax - 5597
* RELIABLE Components Make You Look Sharp!
* TList/Pro * ALLText HT/Pro * MetaDraw *
* Custom Software Development Services Too.
* WWW.Bennet-Tec.Com

=================== ===================

On Jun 21, 3:01 am,
shotokan99 <so**********@yahoo.com>
wrote:
i have this situation. i have a query string:

http://www.myquerystring.com?x=xxxxx

what this url does is it will return or start downloading a .png file.
what i wanted to do is trap this png file and manipuate the image like
resizing, color...etc. how can i do this?
======================================

Jun 21 '07 #6

P: n/a
actually i was able to work it out using this code:
$ch = curl_init();
$timeout = 0;
curl_setopt ($ch, CURLOPT_URL, $xmyurl);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
// Getting binary data
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
$image = curl_exec($ch);
curl_close($ch);

and display the output this way:
header("Content-type: image/png");
echo $image;

now what i want to do is edit that $image as png file using gd. i
tried it:
header('Content-type: image/png');
$xbase = @imagecreatetruecolor(130,168);
$xback=imagecolorallocate($xbase, 39,138,8); //green
imagefill($xbase,0,0,$xback);
imagecopy($xbase,$image,0, 28, 0, 0, 130,140);
imagepng($xbase);

what supposed to happen is $image should be inside $xbase frame.
however it doesnt work, instead only $xbase is showing. what to do
with this?

Jun 22 '07 #7

P: n/a
actually i come up with this:
ch = curl_init();
$timeout = 0;
curl_setopt ($ch, CURLOPT_URL, $xmyurl);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
// Getting binary data
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
$image = curl_exec($ch);
curl_close($ch);

and display the output this way:
header("Content-type: image/png");
echo $image;

now what i want to do is edit $image as png file using gd. i tried it:
header('Content-type: image/png');
$xbase = @imagecreatetruecolor(130,168);
$xback=imagecolorallocate($xbase, 39,138,8); //green
imagefill($xbase,0,0,$xback);
imagecopy($xbase,$image,0, 28, 0, 0, 130,140);
imagepng($xbase);

what supposed to happen is $image should be inside $xbase frame.
however it doesnt work, instead only $xbase is showing. what to do
with this?

Jun 22 '07 #8

P: n/a
Rik
On Fri, 22 Jun 2007 05:07:24 +0200, shotokan99 <so**********@yahoo.com
wrote:
actually i come up with this:
ch = curl_init();
$timeout = 0;
curl_setopt ($ch, CURLOPT_URL, $xmyurl);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
// Getting binary data
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
$image = curl_exec($ch);
curl_close($ch);

and display the output this way:
header("Content-type: image/png");
echo $image;

now what i want to do is edit $image as png file using gd. i tried it:
header('Content-type: image/png');
$xbase = @imagecreatetruecolor(130,168);
$xback=imagecolorallocate($xbase, 39,138,8); //green
imagefill($xbase,0,0,$xback);
imagecopy($xbase,$image,0, 28, 0, 0, 130,140);
imagepng($xbase);

what supposed to happen is $image should be inside $xbase frame.
however it doesnt work, instead only $xbase is showing. what to do
with this?
An image resource is NOT the raw data. Get the image, store it temporarily
on you computer, create an image resource with an imagecreatefrom*()
function and you've got it.

--
Rik Wasmus
Jun 22 '07 #9

This discussion thread is closed

Replies have been disabled for this discussion.