MSN SongText

Your own domain?


it always displays a broken image link
Might it be that your register_globals is off? One way is to turn it on in your php.ini.. and restart the webserver.

Or you can turn it on in a file called .htaccess (if allowed by php.ini) or you can fix the file you get from base64img to support that
register_globals is off.

This might also be a solution.. Put this in the top of your generated file..

// .. continue the script..

or put this in a .htaccess in the same directory..

php_value register_globals 1

Read some more info...
and more about setting values..


I have 2 images converted by base64img. It only displays the first image
note: images created with base64img must always be on the top of the file. It's because it sends header-information to the browser. A common misstake is to put two files together with include, and leave the first file with some blank lines at the end of the file. The other is to not rename the function or the url-parameter "image=1".

A example:
What happens when you are trying to show picture 2 (?image=2 added as the parameter to the url):

callimages.php includes imagefile1.php and does not show anything but the 2 empty lines at the bottom of the file. Then callimages.php includes the imagefile2.php.. imagefile2.php will try to send the header to the browser, but it was already sent. Then the client will not be able to show it correctly.

- Watch out for some empty space... You don't like it ;P

does not work with large jpg files and large gifs
Does it not?
It is a limit on 8 mb or something in php.ini..
try converting it online in the demo before you complain

Fatal error: Call to undefined function: array_key_exists() downloaded your Base64img-script. But when I trie to run it I get the error

Fatal error: Call to undefined function: array_key_exists() in c:\phpdev\www\scripts\base64img.php on line 337
That is rather logical since the function array_key_exists() IS not defined.
Am I doing something wrong or is there a part of the script missing?
I hope you can help me out, because the demo of the script looked VERY interesting :).

try to upgrade your version of PHP.. read about the function on array_key_exists

image does not show..
Try showing the picture alone.. add ?image=1 to the url/http-location and see what the output is.

I want to insert pictures into MySQL database... What about base64img?
base64img is not what you need. It is for putting the picture inside the php-script.
(you might learn something from it.. but it's not what are looking for.

Try a search google.

How to put more than one picture into the script?
you can also look at base64img.php script.. it got two images inside it..

First, upload two images to the base64img.php script. Copy one of the function img() into the other script and rename it from "function img()" such as each image got an uniq function. f.ex:
function img1() {... image ...}
function img2() {... image ...}
# etc...

and change:
if ( array_key_exists("image", $_REQUEST) && $_REQUEST["image"]==1) { img(); die(); }

to :
if ( array_key_exists("image", $_REQUEST) && $_REQUEST["image"]==1) { img1(); die(); }

if ( array_key_exists("image", $_REQUEST) && $_REQUEST["image"]==2) { img2(); die(); }
# etc...

Then the links in the html-part should be like this to show the images:
<img src=<?php echo $_SERVER["PHP_SELF"]; ?>?image=1><br> <img src=<?php echo $_SERVER["PHP_SELF"]; ?>?image=2><br> etc...

You could test each image with url_to_your_script.php?image=1 or url_to_your_script.php?image=2

The base64img script does not work?
It has been tested by a lot and have not been changed much in the last 3 years. If you're new to PHP, you can rather claim the problem you have with your own skills. But, prove me wrong. I will fix the error if you can tell me what's wrong.. :)