Re: Images in a table
Richard Bewley wrote: Yes, you can insert the binary into a table. Richard -Original Message- From: Zenzo [mailto:[EMAIL PROTECTED] Sent: Saturday, November 29, 2003 1:42 PM To: MySQL List Subject: Images in a table If your application is WWW based I've done some notes for students about how to do this (via PHP and a WWW interface). They're at http://www.scit.wlv.ac.uk/~jphb/sst/php/extra/image1.html I've seen several suggestions that putting images directly in MySQL tables is not a good idea and, instead, you should put server side image file names in the database, and let the scripting back-end read the files. I'm neutral on this. How can I insert images in a table if I can do it with MySQL? __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Images in a table
I would be pleased. Thanks Glenn Stauffer [EMAIL PROTECTED] wrote: Zenzo wrote: How can I insert images in a table if I can do it with MySQL? __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ I can send you some simple code to do this using Python. - Do you Yahoo!? Free Pop-Up Blocker - Get it now
Re: Images in a table
Here is a sample code in PHP: $image = file_get_contents('/tmp/my_image.png'); $res = mysql_query('insert into img_table ( data ) values (\''.addslashes($image).'\')'); Works with a table like: create table img_table (bigint not null auto_increment primary key, data LONGBLOB not null default ''); Hopa that helps On Saturday 29 November 2003 19:41, Zenzo wrote: How can I insert images in a table if I can do it with MySQL? __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- Mickael Bailly -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Images in a table
Be warned about hitting the default max_packet_size limitation of mysql which will cause large files to not insert. This link shows another way to overcome that limitation: http://php.dreamwerx.net/forums/viewtopic.php?t=6 On Mon, 1 Dec 2003, Mickael Bailly wrote: Here is a sample code in PHP: $image = file_get_contents('/tmp/my_image.png'); $res = mysql_query('insert into img_table ( data ) values (\''.addslashes($image).'\')'); Works with a table like: create table img_table (bigint not null auto_increment primary key, data LONGBLOB not null default ''); Hopa that helps On Saturday 29 November 2003 19:41, Zenzo wrote: How can I insert images in a table if I can do it with MySQL? __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- Mickael Bailly -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Images in a table
How can I insert images in a table if I can do it with MySQL? __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Images in a table
Yes, you can insert the binary into a table. Richard -Original Message- From: Zenzo [mailto:[EMAIL PROTECTED] Sent: Saturday, November 29, 2003 1:42 PM To: MySQL List Subject: Images in a table How can I insert images in a table if I can do it with MySQL? __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
To insert images in a table - BLOB
Hello List: I am new in this list and in MySQL, I have the following problem: I need to insert files of images in a table, which has a field of type BLOB, I have understood that to do this I can use the function LOAD_FILE(file.bmp), but that this file must be in the server. It is not possible to insert a file that is in a local machine? I have tried the following thing, but without success some insert into tabla1 (let,anio,rec) values ('Z',2001,load_file(c:\graficos\ok.bmp)); rec is the field of type BLOB From already thank you very much. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: To insert images in a table - BLOB
On Wed, 14 Nov 2001, Carlos Alberto Afranllie wrote: I need to insert files of images in a table, which has a field of type BLOB, I have understood that to do this I can use the function LOAD_FILE(file.bmp), but that this file must be in the server. It is not possible to insert a file that is in a local machine? Not with LOAD_FILE, according to the Manual. You must do it inside your application i.e. read the file and generate the corresponding SQL statement using your programmatic means. Do not forget to escape the necessary characters (NUL, \, ', , I think). -- , M A R I O data miner, LIACC, room 221 tel 351+226078830, ext 121 A M A D O Rua Campo Alegre, 823 fax 351+226003654 A L V E S P-4150 PORTO, Portugalmob 351+939354002 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php