In php you can insert pictures into database as blob data type. I'd like to put plots of data into a database as a blob datatype so I can reuse this data on the web with php.
For example:
Needs["DatabaseLink`"];
conn=OpenSQLConnection["myDB"];
picture=Plot[Sin[x], {x,0,2Pi}];
SQLExecute[conn, "INSERT INTO pictures VALUES ('"<>picture<>"')"]
There is an example in V 8.0.4 documentation page SQLBinary that gives the steps needed. After you export picture to a format of your choice as @halirutan and @Verbeia suggested, say
img=ExportString[picture, "PNG"];
you need to convert the resulting string to raw binary data using
byteData=SQLBinary[ToCharacterCode[img]];
Assuming the column pictures (with datatype LONGVARBINARY, VARBINARY or BINARY) lives in, say, PICTABLE then insert byteData into the pictures column using
SQLInsert[conn, "PICTABLE", {"pictures"}, {byteData}];
or equivalent raw SQL command inside SQLExecute[ ... ].
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With