You are here: Re: Prbolem Showing Images « PHP Programming Language « IT news, forums, messages
Re: Prbolem Showing Images

Posted by Erwin Moller on 03/14/07 08:00

Gladen Blackshield wrote:

> Hello;
>
> I'm a bit new to PHP and am having trouble with displaying an image
> through ANY of the IMAGE commands.
>
> I've read EVERY tutorial I could find, and even copied the code from
> exmaples...and nothing runs.
>
> I am running PHP version 4 (4.4.6) with GD 2.0
>
> Each and every image I attempt to display (either through striaght PHP or
> a call through an IMG link) shows up as RAW-DATA text.
>
> I am running on a LINUX serever with PHP 4.4.6
>
> PHP info tells me that I have GD enabled with Jpeg and with PNG.
>
> I've tried each and every type of image, several different images, and all
> I get is
> the following:
>
> ?PNG  IHDRôiåLM@ IDATxo¬½Y",¹Z&ö
> Ý#22ó,µÜ­
»§glæAjé-÷ïd6f'LÒô^îV·ªNzÌO͝ô:f±ä©ºÓ-uÌËÓÝ+ø@îÿÓÿ'R¥UÀÌÃ0¸;3pwwYµÄ"øÉÝã'¼'È©½ofíM"S>>w×yZ¼2ó\Zí
> 3PU¨TÎôFáQa"'V[UefwYçyzg"WyÇR ?(÷ô­[²b:?ã´e·Õ:ã
> &-óä&´7iæ,ý~On9ç?ÇÍ0
> '§YÙn·DÇñîînGIÔ:MÌÌÌ¢zÑÞ<is?fT¥"Æq\­
V)¥â~¦izgf?53ϳNÓd5gwwCËmHéx<fäÕ8®"ÈÍgv°Xr'ÄT
> ÀaûúúúJ"SJ9 "$3+³©ª»?==Z»ûû»o¿ýv³Y«.Ã4ß=<ÎêfÆÌ"T^TMUTR)¥>ç9^
> ¨4cffŬ$Аù>Ë:ñ§ïþ0??¼R>79
> "Íj"{Ê9¯Æ¼9'0¹?T­
W÷ßzr-Âéû×-ÿç·¿ýîÇÏßþÍoÞócAÊÎt~tÖ²'qsw÷_þî?þúÛ_lÆÕ|<äoÇõ`®SÑa\>!ÈÌ)¥aDdµZ1sôaOÿÑۍª#?Ýn7M^Üßß?>>n6>iz{SS7f,K)Ç%.RâùÇrÎ1Öî~8öûýñxTÕRJ×T^ÜFá--¿þõ¯ÿëÿù_ÿñÿñåeKRJ$
> .?9Ùli-RUSrZ ë uȐ?òxwÿððnµZ ±»?<<¤ÌY`js)³Tԍ Ó^@ LtBÑ´
> YqSJÌlf¯¯¯f^tQíRJýµ¨Tw?ÖîmyqP @äDÝ"víoú¯®zG³¼'! Ãjµ
> úic31¥"RáùptèY
> Ý0N8ÉZe,ÔÝAÖº®ïFYÑQ¥<ó©FW©G«Üůý"?ï.DKS
>
>
> etc.
>
> Putting in the HEADER command nets:
>
> Warning: Cannot modify header information - headers already sent by
> (output started at /home/karstens/public_html/test/imgtest.php:9) in
> /home/karstens/public_html/test/imgtest.php on line 11
>
> and then the file output as raw data.
>
> any suggestions? Fixes? Advice?

Hi,

Well, the header is your problem.
You MUST set the right header before sending the imagedata. MUST.
So if you get that error, that means you have been sending other information
first. It can be as much as a newline or a space.
Fix that first.

And one other thing: IF you set the headers right, you will NOT see this
kind of messages anymore, because the browser expects an image.
A simple workaround is temporarely setting your header to text/html, check
if any errors are produced, fix them, then set beack to image/png.


Good luck.

Regards,
Erwin Moller

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация