godbout Posted May 30, 2008 Share Posted May 30, 2008 Hi there! I've got a problem transferring data from an Access database to a mysql one. I'm not responsible for any of these 2 databases, else I would have stored the paths to the pictures rather than the pictures themselves in the db but anyway. I succeeded to transfer all the information except the images. I mean, I can transfer the data but of course, once in mysql, the picture cannot be read correctly. I guess that what I have to do, first, is to read this ole picture from Access and to convert it to jpeg, and then insert it in my mysql db. But I can't find a way to get this ole picture from access and to convert it correctly. Does anyone have any idea? Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/107977-transfer-ole-type-pictures-from-msaccess-to-mysql/ Share on other sites More sharing options...
MadTechie Posted May 30, 2008 Share Posted May 30, 2008 This probably isn't going to be very helpful but.. I would create a little ASP code to convert the OLE back into Jpegs and using the RecordID as the name.. then upload via FTP and then create a little oneoff PHP script link them in heres some ASP code that will display the image, just add a write to binary section <% Dim adoCon Dim rs Dim strSQL Set adoCon = Server.CreateObject("ADODB.Connection") adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("database/images.mdb") Set rs = Server.CreateObject("ADODB.Recordset") strSQL = "SELECT ID,IMAGE FROM table WHERE ID = 1" rs.Open strSQL, adoCon Response.Clear Response.ContentType = "image/jpg" Response.BinaryWrite rs("IMAGE") rs.Close adoCon.Close Set rs = NothingadoCon.Close Set adoConn = Nothing %> Quote Link to comment https://forums.phpfreaks.com/topic/107977-transfer-ole-type-pictures-from-msaccess-to-mysql/#findComment-553546 Share on other sites More sharing options...
godbout Posted June 2, 2008 Author Share Posted June 2, 2008 Thanks for the answer! Actually I'd like to keep php, I guess it should not be so different. For the moment, I read the data, but it's encapsuled with the ole format, that's why I can't read them anyway. I just have to find the way to convert them to jpg, and then I can handle the rest. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/107977-transfer-ole-type-pictures-from-msaccess-to-mysql/#findComment-555306 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.