Jump to content

Recommended Posts

allright, after a few days i give up. When trying to display an image from database i get a page full of ƒ„…†‡ˆ‰Š’“”•–crap.  I´ve tried several pre-written scripts as well the base-code but still the same.

$fileType = @mysql_result($result, 0, "type");
$fileContent = @mysql_result($result, 0, "data");
header("Content-type: $fileType");
echo $fileContent;

data-field is blob.

php -> 4.3.9
mysql -> 4.1
my coffee -> strong.

i found 1 answer for this question on a forum and the answer was that the guy realy should try another code.. could someone pleeeaaaase give me a usefull explanation¿ cause it really doesnt look like something heavy, but just enoying.

thanx!
I have no idea how these data were stored, if any conversion was performed, if non-ascii characters were properly handled, etc... but it looks like you're getting binary data back regardless.
ah, sorry, i knew that i forgot something, but the data is entered with:

$dbQuery = "INSERT INTO bltira VALUES ";
$dbQuery .= "(0, '$strDesc', '$fileContent', '$fileUpload_type')";

the rest of the script you can find here:
http://www.devarticles.com/c/a/MySQL/Blobbing-Data-With-PHP-and-MySQL/

seems to be an goldy-oldy, but the base-scripting (storing/retrieving) seems to be pritty recent.
please tell me if i´m wrong, the main point for me is that this script is gonna work so i can go one with recent phpmysql. Thanx for all support  :)
i try with:
i.e.5
firefox 1.5

GD Version bundled (2.0.28 compatible)
and jpeg/gif/png etc enabled

also get this message sometimes in the beginning of the binary:
CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

i saw an working example on the net at this link
http://www.wellho.net/demo/pic_up.php4

oh, by the way please tell me if i´m not allowed to paste urls or whatever
thanx
hmmmm..  tryd the following headers:

header("Content-type: $fileType");
header("Content-type:'".$fileType);
header("Content-type: file/jpeg");

so the binary data string seems te be allright, it´s just the conversion that goes wrong somewhere¿

then, any idea where and what i could try to change¿
If you edit the "original" file in a binary text editor, do the non-ascii characters match? Let's prove it's a conversion issue.
uhm.. i tried notepad, and got a string that looked a-bit-like-similar but not the whole code, say 50%.
Then i tried a binary text editor whitch gave me binary-chineese, say about 0% similar.

[color=red]just found out! [/color]
when i´m placing this code.. 

header("Content-type: $type");

..then the coding [color=red]ís[/color] the same as in wordpad, only the first 2 rules i´m not sure because notepad gives here squares instead of binary, but both dataoutput and notepad start with.. 

ÿØÿà JFIF [color=red]instead of[/color] CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

..followed by the binary-spaghetti.

yep!  :) using this header:

header("Content-type: $type");

99% equal, except the 3rd and 4rd rule in word, there it gives squares instead of binary, so i think it´s equal enough.
Hmm... if you're getting binary output, with the right header, the browser shouldn't have any issues... not sure why it's not working.
there must be something realy stupid thingy cause the script + engine indeed MUST be allright..

thanx for thinking! :) i´ll update if i can find this little basterd
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.