curl-library
Re: PNG Image resolution
Date: Thu, 29 Dec 2011 23:48:49 -0800
Hi there. That stuff you are seeing is the contents of the png file, like
you would see if you looked at the png file in text editor.
I believe the solution is that you need to set your http headers to
appropriate values to display an image.
Try putting this line at the very top of your php:
Header("Content-Type: image/png");
On Thu, Dec 29, 2011 at 7:29 PM, Robert Ingoglia <ingogliar_at_felician.edu>wrote:
> Greetings,
>
> I am very new to all of this, but if you fine folks would tolerate a
> “newbie,” I would be most appreciative.
>
> To be very brief, I wrote my very first cURL script within a php file and
> uploaded it to my website:
>
> <?php
> $curl = curl_init();
> curl_setopt ($curl, CURLOPT_URL, "http://www.cnn.com");
> curl_exec ($curl);
> curl_close ($curl);
> ?>
>
> IT WORKS PERFECTLY! (sorry to shout, but I am ecstatic)
>
> However, when I modify the name of the url (so that a grapic file with a
> png extension is “pointed to”):
>
> <?php
> $curl = curl_init();
> curl_setopt ($curl, CURLOPT_URL, "
> http://water.weather.gov/resources/hydrographs/lodn4_hg.png");
> curl_exec ($curl);
> curl_close ($curl);
> ?>
>
> …The picture does not show up (as a picture) but as gibberish:
>
> ‰PNG IHDRXÑï7c¿PLTEßßÿ -ŸŸÛÿÿÿg_·Â¿âI?©àßð¤ŸÔ+›†Æ²ÌäØåñØðú²ãöÿ
> rrÜ[fíglÿÆrܯfí»lÿÿrÜèfíólíøpÜònÝÝÝÃÃßSS_oo77?‹‹Ÿ§§¿’’§ªªÃ
> 007HHSaao}}yy‹@@ÿ\hüy‘ú•ºøNTý£Î÷j}ûµµåggöÉÉáSVþÏÏÿ‡¥ùSS
> ú¢¢éççÿWWÿooÿ‡‡ÿflýŸŸÿ··ÿff¨Æäy8Š …
>
> If I may just ask someone to tell me what I am doing incorrectly (nothing
> else but that), I would be thrilled.
>
> Thanks!
>
> Respectfully,
>
> *Dr. Robert Ingoglia*
> Professor - Department of History
> Felician College
> 262 South Main Street
> Lodi, NJ 07644
> office: 201-559-6135 (voice mail available)
> *web page: **http://faculty.felician.edu/ingogliar*<http://faculty.felician.edu/ingogliar>
> Member of CWOP (Citizen Weather Observer Program)
> *Station: DW8219 at **http://heightsweather.info*<http://heightsweather.info>
> * *
>
> "What Orwell feared were those who would ban books. What Huxley feared was
> that there would be no reason to ban a book, for there would be no one who
> wanted to read one."
>
> Neil Postman, *Amusing Ourselves to Death*, p. vii
>
>
>
>
> ______________________________________________________________________
> This outgoing email has been scanned by the MessageLabs Email Security
> System for Felician College.
> _____________________________________________________________________
>
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-12-30