0

The question is in the title. I am having trouble in blob images display since a few days.
When i look to binary datas of the displayed images (who display with the broken symbol, actually they dont really display), i get different raw data form orginal .jpg and the file_get_content() binary file generated.
Here is a related post orm yesterday with some more explanations.
--> mysql blob image displaying with php/html

Community
  • 1
  • 1

1 Answers1

3

Short answer is : yes. There's no reason the contents should be different. Your problem is probably in another castle.

Nick
  • 3,231
  • 2
  • 28
  • 50
Evert
  • 93,428
  • 18
  • 118
  • 189
  • I totally agree with you... Maybe when the return of file_get_content() goes into the Mysql BLOB it get modified? Check my link and tell me if you see anything suspect from my code –  Aug 09 '12 at 09:24
  • Or maybe it can come from the headers? –  Aug 09 '12 at 09:26
  • If you were sitting in my office, and ask the same question. I would ask that you install Charles HTTP Proxy, and I'd go over the exact response from that url to look for something suspicious. – Evert Aug 09 '12 at 09:30
  • Hum, I already have the devtool from Chrome who allow me to check headers, but thanks for your answers. Problem is that I dont understand really well the meaning of all those headers things, I gonne check it out on the internet. –  Aug 09 '12 at 09:32
  • Having this return after uploading my image: ------WebKitFormBoundaryFxYwOIY8tJCfDekb Content-Disposition: form-data; name="avatar"; filename="original.gif" Content-Type: image/gif ------WebKitFormBoundaryFxYwOIY8tJCfDekb-- Response Headersview source Connection:Keep-Alive Content-Length:2872 Content-Type:image/gif Date:Thu, 09 Aug 2012 09:36:11 GMT Keep-Alive:timeout=5, max=62 Server:Apache/2.4.2 (Win64) PHP/5.4.3 X-Powered-By:PHP/5.4.3`code` –  Aug 09 '12 at 09:37
  • @Mayerz Can you access the image file on the server (and read it?). That way we'd know whether it's the reading or the writing which is the problem. – h2ooooooo Aug 09 '12 at 09:39
  • I apologize I'm having trouble in formatting thoses comments :/ It didnt work the same way as question's posting. –  Aug 09 '12 at 09:40
  • Yes I can read it. It is stored in my DB as a blob, I can access it. But when i read it adding .jpg i didn't work –  Aug 09 '12 at 09:41
  • Oh god, the original image binary datas, and the ones from my DB are the same. So the problem is coming from the display process, because then when it display I only see the broken-image icon, and when I download it, the binary data isnt the same. –  Aug 09 '12 at 09:43
  • Ok founded out the solution by using the data URI, see here if you have same problem as me http://stackoverflow.com/a/2070625/1585121. Have a nice day! –  Aug 09 '12 at 11:57