0

Could someone help me with issue of selecting an image from mySQL(running on CentOS) in PHP.

I do have a field: ImageBlob (LONGBLOB) scanned image is stored from 4D(fourth dimension) application and data on the field looks like: 0x85DA0000789C84B8739028CDB6E...

I have tried to retrieve it on my website in 100s of different ways(decode_64, various MIMEs etc.), but image doesn't appear, what I was able to get is:

  1. blank white screen
  2. black whole screen
  3. string: ??x???s?(???m?m?m?m???????.....
  4. string: hdoAAHichLhzkCjNtubdtm0bu23btm3bto....

Any ideas are welcome

shilovk
  • 11,718
  • 17
  • 75
  • 74
Rytis
  • 1
  • 1
  • Please edit your question to include the code you're using to extract this information from the database (make sure you mask any username/password) and also the code you're using to display that data. Are you setting the MIME type for the data you're displaying? Generally you don't want to store images in the database, instead you store path information (/home/rytis/images/0001.jpg for example). – Benny Hill Nov 27 '17 at 12:52
  • I have used the code like: echo ''; and various attempts which I was able to find on stackoverflow and other sources also I have tried various MIME types and still nothing. The problem I think that I do not know what kind of file is stored on database. 4D (fourth dimension) software using some kind qPix plugin which does convert from scanned PDF into some kind of image file – Rytis Nov 27 '17 at 14:14
  • if you have no idea what the file type is then you can't assume it's a jpg. Possibly it's something proprietary. You really need to discover this before you can continue. – ADyson Nov 27 '17 at 14:55
  • PHP handles binary data just fine, you don't even need to do anything special (just not mangle the data). But you're apparently asking a browser to render as JPEG something that is not a JPEG—that's an entirely different problem. – Álvaro González Nov 27 '17 at 15:16
  • I thought it's tiff, but doesn't open as MIME/tiff as well... – Rytis Nov 27 '17 at 15:29
  • I've created a sample TIFF and it starts with `49 49 2A`. But browsers don't normally include graphic libraries to open TIFF files or other file formats that are not usual in web sites. – Álvaro González Nov 28 '17 at 08:11

0 Answers0