stimpson Posted November 11, 2006 Share Posted November 11, 2006 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.9mysql -> 4.1my 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! Quote Link to comment https://forums.phpfreaks.com/topic/26953-image-from-database-displays-like-%C6%92%E2%80%9E%E2%80%A6%E2%80%A0%E2%80%A1%CB%86%E2%80%B0%C5%A1%E2%80%99%E2%80%9C%E2%80%9D%E2%80%A2%E2%80%93/ Share on other sites More sharing options...
fenway Posted November 12, 2006 Share Posted November 12, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/26953-image-from-database-displays-like-%C6%92%E2%80%9E%E2%80%A6%E2%80%A0%E2%80%A1%CB%86%E2%80%B0%C5%A1%E2%80%99%E2%80%9C%E2%80%9D%E2%80%A2%E2%80%93/#findComment-123410 Share on other sites More sharing options...
stimpson Posted November 13, 2006 Author Share Posted November 13, 2006 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 :) Quote Link to comment https://forums.phpfreaks.com/topic/26953-image-from-database-displays-like-%C6%92%E2%80%9E%E2%80%A6%E2%80%A0%E2%80%A1%CB%86%E2%80%B0%C5%A1%E2%80%99%E2%80%9C%E2%80%9D%E2%80%A2%E2%80%93/#findComment-123764 Share on other sites More sharing options...
fenway Posted November 15, 2006 Share Posted November 15, 2006 OK... I still see binary content being returned, maybe just the header isn't being respected? Quote Link to comment https://forums.phpfreaks.com/topic/26953-image-from-database-displays-like-%C6%92%E2%80%9E%E2%80%A6%E2%80%A0%E2%80%A1%CB%86%E2%80%B0%C5%A1%E2%80%99%E2%80%9C%E2%80%9D%E2%80%A2%E2%80%93/#findComment-125090 Share on other sites More sharing options...
stimpson Posted November 15, 2006 Author Share Posted November 15, 2006 i try with:i.e.5firefox 1.5GD Version bundled (2.0.28 compatible)and jpeg/gif/png etc enabledalso 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 linkhttp://www.wellho.net/demo/pic_up.php4 oh, by the way please tell me if i´m not allowed to paste urls or whateverthanx Quote Link to comment https://forums.phpfreaks.com/topic/26953-image-from-database-displays-like-%C6%92%E2%80%9E%E2%80%A6%E2%80%A0%E2%80%A1%CB%86%E2%80%B0%C5%A1%E2%80%99%E2%80%9C%E2%80%9D%E2%80%A2%E2%80%93/#findComment-125131 Share on other sites More sharing options...
fenway Posted November 15, 2006 Share Posted November 15, 2006 Yes, but that has to do with the original image metadata, not the header on output... Quote Link to comment https://forums.phpfreaks.com/topic/26953-image-from-database-displays-like-%C6%92%E2%80%9E%E2%80%A6%E2%80%A0%E2%80%A1%CB%86%E2%80%B0%C5%A1%E2%80%99%E2%80%9C%E2%80%9D%E2%80%A2%E2%80%93/#findComment-125247 Share on other sites More sharing options...
stimpson Posted November 16, 2006 Author Share Posted November 16, 2006 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¿ Quote Link to comment https://forums.phpfreaks.com/topic/26953-image-from-database-displays-like-%C6%92%E2%80%9E%E2%80%A6%E2%80%A0%E2%80%A1%CB%86%E2%80%B0%C5%A1%E2%80%99%E2%80%9C%E2%80%9D%E2%80%A2%E2%80%93/#findComment-125462 Share on other sites More sharing options...
fenway Posted November 16, 2006 Share Posted November 16, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/26953-image-from-database-displays-like-%C6%92%E2%80%9E%E2%80%A6%E2%80%A0%E2%80%A1%CB%86%E2%80%B0%C5%A1%E2%80%99%E2%80%9C%E2%80%9D%E2%80%A2%E2%80%93/#findComment-125713 Share on other sites More sharing options...
stimpson Posted November 16, 2006 Author Share Posted November 16, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/26953-image-from-database-displays-like-%C6%92%E2%80%9E%E2%80%A6%E2%80%A0%E2%80%A1%CB%86%E2%80%B0%C5%A1%E2%80%99%E2%80%9C%E2%80%9D%E2%80%A2%E2%80%93/#findComment-125760 Share on other sites More sharing options...
fenway Posted November 16, 2006 Share Posted November 16, 2006 Strange... I'm just trying to determine where the problem lies. Quote Link to comment https://forums.phpfreaks.com/topic/26953-image-from-database-displays-like-%C6%92%E2%80%9E%E2%80%A6%E2%80%A0%E2%80%A1%CB%86%E2%80%B0%C5%A1%E2%80%99%E2%80%9C%E2%80%9D%E2%80%A2%E2%80%93/#findComment-125771 Share on other sites More sharing options...
stimpson Posted November 16, 2006 Author Share Posted November 16, 2006 [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. Quote Link to comment https://forums.phpfreaks.com/topic/26953-image-from-database-displays-like-%C6%92%E2%80%9E%E2%80%A6%E2%80%A0%E2%80%A1%CB%86%E2%80%B0%C5%A1%E2%80%99%E2%80%9C%E2%80%9D%E2%80%A2%E2%80%93/#findComment-125829 Share on other sites More sharing options...
stimpson Posted November 21, 2006 Author Share Posted November 21, 2006 sooooo, anybody any idea what i could try now? i know its busy here so thanx if you have the time Quote Link to comment https://forums.phpfreaks.com/topic/26953-image-from-database-displays-like-%C6%92%E2%80%9E%E2%80%A6%E2%80%A0%E2%80%A1%CB%86%E2%80%B0%C5%A1%E2%80%99%E2%80%9C%E2%80%9D%E2%80%A2%E2%80%93/#findComment-127961 Share on other sites More sharing options...
fenway Posted November 21, 2006 Share Posted November 21, 2006 I really would like to help -- have we established that the correct binary stream is being returned? Quote Link to comment https://forums.phpfreaks.com/topic/26953-image-from-database-displays-like-%C6%92%E2%80%9E%E2%80%A6%E2%80%A0%E2%80%A1%CB%86%E2%80%B0%C5%A1%E2%80%99%E2%80%9C%E2%80%9D%E2%80%A2%E2%80%93/#findComment-127992 Share on other sites More sharing options...
stimpson Posted November 22, 2006 Author Share Posted November 22, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/26953-image-from-database-displays-like-%C6%92%E2%80%9E%E2%80%A6%E2%80%A0%E2%80%A1%CB%86%E2%80%B0%C5%A1%E2%80%99%E2%80%9C%E2%80%9D%E2%80%A2%E2%80%93/#findComment-128768 Share on other sites More sharing options...
fenway Posted November 23, 2006 Share Posted November 23, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/26953-image-from-database-displays-like-%C6%92%E2%80%9E%E2%80%A6%E2%80%A0%E2%80%A1%CB%86%E2%80%B0%C5%A1%E2%80%99%E2%80%9C%E2%80%9D%E2%80%A2%E2%80%93/#findComment-129240 Share on other sites More sharing options...
stimpson Posted November 27, 2006 Author Share Posted November 27, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/26953-image-from-database-displays-like-%C6%92%E2%80%9E%E2%80%A6%E2%80%A0%E2%80%A1%CB%86%E2%80%B0%C5%A1%E2%80%99%E2%80%9C%E2%80%9D%E2%80%A2%E2%80%93/#findComment-131147 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.