close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Display JPG stored in MySQL Binary record

Thread began 2/11/2010 10:12 am by tom92909 | Last modified 2/11/2010 1:26 pm by tom92909 | 2745 views | 5 replies |

tom92909Beta Tester

Display JPG stored in MySQL Binary record

I have successfully stored a standard JPG photograph in MySQL using a simple DA insert page. The Photofile field structure is setup as ( longblob, BINARY ).

Now I'd like to recall that file and display this image as desired.

How is the <img> operation accomplished?

php:
<table class="WADAResultsTable" border="0" cellpadding="0" cellspacing="0">

                <tr>
                  <th class="WADAResultsTableHeader">Date:</th>
                  <th class="WADAResultsTableHeader">Description:</th>
                  <th class="WADAResultsTableHeader">Filename:</th>
                  <th class="WADAResultsTableHeader">&nbsp;</th>                  
                </tr>
                <?php do { ?>
                  <tr class="<?php echo $WARRT_AltClass1->getClass(true); ?>">
                    <td class="WADAResultsTableCell"><a href=""></a><?php echo($row_WADAfiles['Date']); ?></td>
                    <td class="WADAResultsTableCell"><?php echo($row_WADAfiles['Description']); ?></td>
                    <td class="WADAResultsTableCell"><?php echo $row_WADAfiles['Photofile']; ?></td>
                    <td class="WADAResultsTableCell"><a href="<?php echo $row_WADAfiles['Photofile']; ?>"><img  src="images/mini_info.png" border="0" /></a></td>                    
                  </tr>
                  <?php } while ($row_WADAfiles mysql_fetch_assoc($WADAfiles)); ?>
              </table>



I'm getting the following error...

The requested URL /102_2575.JPG was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


Thanks in advance.

Sign in to reply to this post

Jimmy Wu

I would suggest that instead of inserting the image into the database, that you just upload it to your server and store the image name and root relative path in your database. Then you can dynamically get the image path and name from your database and the image will be uploaded to your server.

Sign in to reply to this post

tom92909Beta Tester

Jimmy,

Thank you for your quick response.

I truly appreciate your comment, but I have a requirement for this project to actually store the binary image in MySQL, and then at times retrieve the image from MySQL and display that records image file.

Your response and comments are greatly appreciated.


Tom

Sign in to reply to this post

tom92909Beta Tester

I'm really confused. MySQL provides a way to store Binaries with a BLOB. Once I've stored a file in there, how on earth am I supposed to get it out?

I've spent almost 5 hours today trying to retrieve specific JPG images out of a Longblob field. I can display the filename that was stored from the upload / insert, but I can't display the image.

Any suggestions would be greatly appreciated.


Tom

Sign in to reply to this post

Jason ByrnesWebAssist

Digital File pro does not support storing the image in the MySQL Database in blob fields, you will have to hand the functionality to store the image and retrieve it.

I was able to find the following article through Google that you may find helpful:
php-example-php-form-image-upload-store-in-mysql-database-retreive.html


but this is not something that WebAssist can offer support on.

Sign in to reply to this post

tom92909Beta Tester

Jason,

Thank you for your response.

Tom

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...