![]() |
ARRGH! GD!!!!!!!!! help..
PHP Code:
PHP Code:
PHP Code:
|
Works for me, try wrapping it in ob_start and ob_end_flush
|
PHP Code:
|
something is sending headers out to the browser before your script can, you got other scripts running?
|
No , the only thing I can think of is include('clasess.php'); that has the image class which is sending the header.
|
I understand that whitespace after the ?> php tag can cause problems with header stuff, you checked that?
|
Maybe try putting the header at the top above the class.
|
Still not working, im just trying to make a simple class that will render the variable into an image
PHP Code:
PHP Code:
Code:
�����JFIF���������>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality ���C� $.' ",#(7),01444'9=82<.342���C 2!!22222222222222222222222222222222222222222222222222������"�������������� �������}�!1AQa"q2���#B��R��$3br� %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz����������������������������������������������������������������������������������� ������w�!1AQaq"2�B���� #3R�br� $4�%� &'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz��������������������������������������������������������������������������� ��?���(�獦��$�HЪ�R�H��p##� �PhJ+��'�K���`ү.���n�Ka%���A�tbp�k���df#nv��ƞ%�ӧ���V:�����Y�i�o��- ϑ##�W)ʱ�Z��+��OV��4�WU�g���Ƣ;ؒ(�i �UCJSk�)��`�{F��[�����V�D�;��1<�W���@QE�QE�QE�QE�QE�QE�QE�QE�QE�QE�QE�QE�QE�QE�QE�QE�QE�QE�QE�QE�QE�QE�QE��� |
You are outputting the image as text, put the following line of code at the top of the script to tell the browser that we are working with an image:
header('Content-type: image/jpeg'); When a browser receives content, it must be told what it is. Since most things a browser displays are text, that is the default. So if you are displaying some other file format, the browser has to know. Headers is how you tell it what its dealing with.. |
Code:
* Warning: Cannot modify header information - headers already sent by (output started at C:\www\page.php:3) in C:\www\lib\clasess.php on line 64 |
You can't have both html and picture render in the same page, because the header("Content-type: image/jpeg"); header would tell the browser to render it as a jpg page, instead of a html page..
In order to get this working, you need to separate this 2 file. //The image file PHP Code:
//the html page PHP Code:
Since your are parsing a email, so it is quite sensitive, so rather than passing the email as the parameter, i would recommend you to query the database and get the email for parsing on your image side. |
Quote:
|
Quote:
PHP Code:
|
Quote:
I see what you are saying, but im basically trying to use this string to generate text into image , not to watermark images. |
1 Attachment(s)
This is already a string to image script... i have attach a working attachment for you to try out. 8-)
|
works pretty well, but wouldn't that be a hazard because anyone could use my website to generate text and kill my bandwith..
|
Its possible yes, if you use GET.
I suppose you could faff around checking referrer headers etc but there not reliable. Shouldnt be a problem if you only use a value defined by you (as in your first example). If it were me I would generate the images in a managed environment, for example when the user registers/changes his/her email address, then just display the img (from db/file system) instead of having to completely rebuild the image from scratch every time. That will also save a bit of the servers CPU power for other things (albeit not alot, it all adds up you know!). |
Don't worried man, i see most of the website are doing this. =D... I agree to SketchMedia, if you have a high traffic on your website, save the generate image to the hardisk instead.
If you do not want to save to your hardisk, Query the database for the email in the image.php file, that means that this image.php is only usable by you and useless for other website. That is what i always do. |
How would I cache it?
|
what editor were you using to create that? i have noticed a few editors out there place junk characters before the <?php tag and when you try to output something it gives that header error thing. next time try opening the file in notepad and see if you see junk characters in it.
|
| All times are GMT. The time now is 07:47 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0