?
Solved

How can I save an image from SQL Server 2008 R2 database image field to web server drive using PHP

Posted on 2013-06-07
2
Medium Priority
?
710 Views
Last Modified: 2013-06-10
Greetings!

I have an application that syncs data from a SQL Server 2008 R2 database to a PHP driven web application.

The database has product images stored in datatype image fields and I need to save the  image to a file on the web server drive and then insert a link into the mySQL table for the application.

This is on a Centos web server using PHP with mssql extensions for php.

I would really appreciate any direction on accomplishing this.

Lynn
0
Comment
Question by:lthames
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 39230417
Without any test data I can't answer this completely, but the general flow would go something like this.

Add a column to the product images table that indicates "isProcessed."  You want this because you will not want a query that does a SELECT * without LIMIT.  That will give you too much data.

SELECT the image information from the product images table with TOP(5) or some similar limit and a WHERE clause that looks for a negative indicator in the "isProcessed" column.  Write the image information into the server file system (use your own methods of determining the image file name).  When the write is complete, INSERT the file name URL into the MySQL data base.  Then UPDATE the product images table to show that the row has been processed.

You can rerun this query structure over and over, until all of the MSSQL data base rows show "isProcessed."
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 39235232
Thanks for the points and best of luck with it, ~Ray
0

Featured Post

Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question