Re: Working with Images
Victor Subervi schrieb: Hi; The python code works properly, so I assume this is a strictly MySQL question now :) If I grab an image in the database thus: sql = select pic1 from products where id=' + str(id) + '; cursor.execute(sql) pic1 = cursor.fetchall()[0][0].tostring() # pic1 = cursor.fetchall()[0][0] // either this or the above line and try and re-insert it thus: cursor.execute('update products set pic1=%s where id=%s, ;', (pic1, id)) i am not familiar with this python db abstraction class, but the last comma seems to be wrong try 'update products set pic1=%s where id=%s;' instead of 'update products set pic1=%s where id=%s, ;' or even without ';' too and is this some sort of prepared statement, or are the parameters escaped somewhere else? -- Sebastian Mendel -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Working with Images
Victor, Please give us an example with the python removed and include the actual syntax error. -Eric On Fri, Apr 18, 2008 at 8:41 AM, Victor Subervi [EMAIL PROTECTED] wrote: Hi; The python code works properly, so I assume this is a strictly MySQL question now :) If I grab an image in the database thus: sql = select pic1 from products where id=' + str(id) + '; cursor.execute(sql) pic1 = cursor.fetchall()[0][0].tostring() # pic1 = cursor.fetchall()[0][0] // either this or the above line and try and re-insert it thus: cursor.execute('update products set pic1=%s where id=%s, ;', (pic1, id)) it tells me I have an error in my MySQL syntax. What is the error? TIA, Victor -- high performance mysql consulting. http://provenscaling.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Working with Images
Hi; The python code works properly, so I assume this is a strictly MySQL question now :) If I grab an image in the database thus: sql = select pic1 from products where id=' + str(id) + '; cursor.execute(sql) pic1 = cursor.fetchall()[0][0].tostring() # pic1 = cursor.fetchall()[0][0] // either this or the above line and try and re-insert it thus: cursor.execute('update products set pic1=%s where id=%s, ;', (pic1, id)) it tells me I have an error in my MySQL syntax. What is the error? TIA, Victor
Adding Images
Hi; I´m trying to figure out how to upload images into a MySQL database. (Yes, that is what I want to do.) I have a form that asks for data, like this: 1ra Foto Pequeña: input type='file' name='pic1' / Then I send that form to a python script that processes like this: cursor.execute('insert into products (' + col_names + ') values (' + col_values + ');') where col_names is all the names of the columns and col_values, obviously, the values. Works fine for strings and digits. Not so well for files :) What do? TIA, Victor
Re: Adding Images
Victor, you are on the wrong list. Your problem is not a MySQL problem (at least, not yet) but a question of how python deals with uploaded files (which, in ANY environment is radically different than the way normal form elements are treated). Try the python groups. - michael dykman On Fri, Mar 28, 2008 at 11:35 AM, Victor Subervi [EMAIL PROTECTED] wrote: Hi; I´m trying to figure out how to upload images into a MySQL database. (Yes, that is what I want to do.) I have a form that asks for data, like this: 1ra Foto Pequeña: input type='file' name='pic1' / Then I send that form to a python script that processes like this: cursor.execute('insert into products (' + col_names + ') values (' + col_values + ');') where col_names is all the names of the columns and col_values, obviously, the values. Works fine for strings and digits. Not so well for files :) What do? TIA, Victor -- - michael dykman - [EMAIL PROTECTED] - All models are wrong. Some models are useful. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Adding Images
In the last episode (Mar 28), Victor Subervi said: Hi; I'm trying to figure out how to upload images into a MySQL database. (Yes, that is what I want to do.) I have a form that asks for data, like this: 1ra Foto Pequeña: input type='file' name='pic1' / Then I send that form to a python script that processes like this: cursor.execute('insert into products (' + col_names + ') values (' + col_values + ');') You want to use prepared statements, bind varaibles, or placeholders (depending on the terminology python uses) instead of manually building queries by string concatenation. -- Dan Nelson [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: IMAGES/PICTURES-MYSQL
Hi! I have seen in this page http://www.blobstreaming.org/ but i think that it´s quite difficult. I want to put only the url of the image, and as you said the pictures o images might be in the server folder, but what is the folder? Thanks. -- View this message in context: http://www.nabble.com/IMAGES-PICTURES-MYSQL-tf4845682.html#a13923823 Sent from the MySQL - General mailing list archive at Nabble.com. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: IMAGES/PICTURES-MYSQL
Hello! I have tried the instructions that you explain to me. I have read also some issues but doens´t work. So i have done: ui:tableColumn binding=#{STOCKSOC.tableColumn6} headerText=image id=tableColumn6 sort=producto.image ui:imageHyperlink action=#{STOCKSOC.imageHyperlink1_action} binding=#{STOCKSOC.imageHyperlink1} id=imageHyperlink1 imageURL=C:\Documents and Settings\Ibai Leizea\Escritorio\gsg\SociedadGastronomica\web\IMAGES\im?imageid=#{currentRow.value['producto.id_prod']} text= url=C:\Documents and Settings\Ibai Leizea\Escritorio\gsg\SociedadGastronomica\web\IMAGES\im?imageid=#{currentRow.value['producto.id_prod']}/ /ui:tableColumn http://www.nabble.com/file/p13894350/1.jpg http://www.nabble.com/file/p13894350/2.jpg http://www.nabble.com/file/p13894350/3.jpg I don´t know if my proyect is in the correct path (C:\Documents and Settings\Ibai Leizea\Escritorio\gsg\SociedadGastronomica\) or the images (C:\Documents and Settings\Ibai Leizea\Escritorio\gsg\SociedadGastronomica\web\IMAGES). I have also proved copying the IMAGE folder in other path, but it doesn´t work. I don´t know specifically which is the server path. Thanks to everybody! Ibai -- View this message in context: http://www.nabble.com/IMAGES-PICTURES-MYSQL-tf4845682.html#a13894350 Sent from the MySQL - General mailing list archive at Nabble.com. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
IMAGES/PICTURES-MYSQL
Hello to everybody! I have read some messages about this topic but i haven´t resolved my problem yet. I am using mySQL Query Browser to make de schema. And i have a table (product) where there are some attributes (producto, precio, nUds,tipo)(spanish). All are relationated with one product (ex: heineken beer). So, i want to put another atribute image where i can put the image of all the products. But i have read that is imposible, that i have to put the path of the jpeg or gif, but i don´t know how. If anyone could help me i will be grateful. Attached is the image of my DB: http://www.nabble.com/file/p13863505/7.jpg Thank you very much! *Sorry for my english -- View this message in context: http://www.nabble.com/IMAGES-PICTURES-MYSQL-tf4845682.html#a13863505 Sent from the MySQL - General mailing list archive at Nabble.com. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: IMAGES/PICTURES-MYSQL
Hi, I have read some messages about this topic but i haven´t resolved my problem yet. I am using mySQL Query Browser to make de schema. And i have a table (product) where there are some attributes (producto, precio, nUds,tipo)(spanish). All are relationated with one product (ex: heineken beer). So, i want to put another atribute image where i can put the image of all the products. But i have read that is imposible, that i have to put the path of the jpeg or gif, but i don´t know how. If anyone could help me i will be grateful. Attached is the image of my DB: What makes you think it's impossible to store the actual image inside a blob field? Martijn Tonies Database Workbench - development tool for MySQL, and more! Upscene Productions http://www.upscene.com My thoughts: http://blog.upscene.com/martijn/ Database development questions? Check the forum! http://www.databasedevelopmentforum.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: IMAGES/PICTURES-MYSQL
Hello! I have read that. But i have not idea what i have to do. Because i´m amateur in this topic. Thank you -- View this message in context: http://www.nabble.com/IMAGES-PICTURES-MYSQL-tf4845682.html#a13865352 Sent from the MySQL - General mailing list archive at Nabble.com. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: IMAGES/PICTURES-MYSQL
It all comes down to what you are most comfortable with. What I have done is to name each image file with a serial number (1.jpg, 2.gif, 3.png, ...) and store the path along with the real name of the image in a table row. Doing it this way means that you don't need to program logic to convert a blob in order to serve it up with a script, you just need to programmatically create a link to the image file and let the web server do it. I find that easier to work with, and certainly easier to debug. Regards, Jerry Schwartz The Infoshop by Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 www.the-infoshop.com www.giiexpress.com www.etudes-marche.com -Original Message- From: puntapari [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 20, 2007 3:38 PM To: mysql@lists.mysql.com Subject: Re: IMAGES/PICTURES-MYSQL Hello! I have read that. But i have not idea what i have to do. Because i´m amateur in this topic. Thank you -- View this message in context: http://www.nabble.com/IMAGES-PICTURES- MYSQL-tf4845682.html#a13865352 Sent from the MySQL - General mailing list archive at Nabble.com. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] infoshop.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Images
Hi How do I add an image to a database and how do I extract from the database? Thanks -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Images
Hodren How are you storing the image in MySQL..I assume longblob? What format will you use to display the image {jpg|gif|png}? Here is a script which will load the images to your AS movie http://www.actionscript.org/forums/showthread.php3?t=76421 HTH/ Martin This email message and any files transmitted with it contain confidential information intended only for the person(s) to whom this email message is addressed. If you have received this email message in error, please notify the sender immediately by telephone or email and destroy the original message without making a copy. Thank you. - Original Message - From: Hodren Naidoo [EMAIL PROTECTED] To: MyS mysql@lists.mysql.com Sent: Sunday, August 05, 2007 9:39 AM Subject: Images Hi How do I add an image to a database and how do I extract from the database? Thanks -- 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]
mysql query question (images,tags)
hi to all, I have a simple question/szenario. Here are my tables: 1. image (id, name) 2. tag (id, name) 3. images_tags (image_id, tag_id) At the moment I have the following working query, it selects all images which have *at least one of the tag ids* (25,30) assigned. SELECT DISTINCT image.id, image.label FROM `image` JOIN `images_tags` ON image.id = images_tags.image_id images_tags.tag_id IN (25,30) Now my plan is to adjust the query so that only images are selected which have *all the tags assigned*, so the IN command in the ON clause does not fit anymore. Here is my attempt to replace the IN: SELECT DISTINCT image.id, image.label FROM `image` JOIN `images_tags` ON image.id = images_tags.image_id ( images_tags.tag_id = 25 images_tags.tag_id = 30 ) But it doesnt´t work :( It would be awesome if somebody could help me. thanks a lot! -jens -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: mysql query question (images,tags)
Jens Kleikamp schrieb: hi to all, I have a simple question/szenario. Here are my tables: 1. image (id, name) 2. tag (id, name) 3. images_tags (image_id, tag_id) At the moment I have the following working query, it selects all images which have *at least one of the tag ids* (25,30) assigned. SELECT DISTINCT image.id, image.label FROM `image` JOIN `images_tags` ON image.id = images_tags.image_id images_tags.tag_id IN (25,30) Now my plan is to adjust the query so that only images are selected which have *all the tags assigned*, so the IN command in the ON clause does not fit anymore. Here is my attempt to replace the IN: SELECT DISTINCT image.id, image.label FROM `image` JOIN `images_tags` ON image.id = images_tags.image_id ( images_tags.tag_id = 25 images_tags.tag_id = 30 ) Solution #1: SELECT fgl_image.id, fgl_image.label FROM fgl_image, fgl_images_tags A, fgl_images_tags B WHERE fgl_image.id = A.image_id AND fgl_image.id = B.image_id AND A.tag_id =10 AND B.tag_id =9 Solution #2: SELECT fgl_image.id, fgl_image.label FROM fgl_image INNER JOIN fgl_images_tags ON fgl_images_tags.image_id = fgl_image.id AND fgl_images_tags.tag_id IN ( 10, 9 ) GROUP BY fgl_image.id, fgl_image.label HAVING COUNT( * ) =2 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: storing images in the database
Hi, In my honest opinion, uploading the image to a preset directory in the code, and setting the code to submit the image name, extension, and if needs be (it shouldnt, because you can set it in the HTML), the directory. Google has a lot of useful resources on this. But, if you are really desperate to do it using the BLOB type, http://www.wellho.net/solutions/php-example-php-form-image-upload-store-in-mysql-database-retreive.html was a help to me when I first started learning. Hope this helps, r # Richard Harris PHP, MYSQL, XHTML, CSS [EMAIL PROTECTED] [EMAIL PROTECTED] # Rodney Courtis wrote: Hi I want to store jpeg images in a mysql database from php in the form of 'blob' types. Is this possible and can you detail for me the steps to achieve this? Regards and thanks Rodney Courtis -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: storing images in the database
I've stored millions of images/files in mysql with minimal performance hit, performance loss is mostly based on your storage implementation. Checkout this article: http://www.dreamwerx.net/phpforum/?id=1 On 10/11/06, Greg Donald [EMAIL PROTECTED] wrote: On 10/10/06, Rodney Courtis [EMAIL PROTECTED] wrote: I want to store jpeg images in a mysql database from php in the form of 'blob' types. Is this possible and can you detail for me the steps to achieve this? For a nice size performance hit, yup: http://www.zend.com/zend/trick/tricks-sept-2001.php?article=tricks-sept-2001kind=trid=2033open=1anc=0view=1 -- Greg Donald http://destiney.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]
storing images in the database
Hi I want to store jpeg images in a mysql database from php in the form of 'blob' types. Is this possible and can you detail for me the steps to achieve this? Regards and thanks Rodney Courtis
Re: storing images in the database
On 10/10/06, Rodney Courtis [EMAIL PROTECTED] wrote: I want to store jpeg images in a mysql database from php in the form of 'blob' types. Is this possible and can you detail for me the steps to achieve this? For a nice size performance hit, yup: http://www.zend.com/zend/trick/tricks-sept-2001.php?article=tricks-sept-2001kind=trid=2033open=1anc=0view=1 -- Greg Donald http://destiney.com/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Images Table
I am looking to create a database that holds the location of images on my server. I was wondering if anyone could help me understand if I am doing it correctly, and if I either need to add, change or remove something from the current table code. img_idINTNOT NULL auto_increment PRIMARY KEY, user_id INTNOT NULL, location VARCHAR(255) NOT NULL, imgtype VARCHAR(20) NOT NULL, img_tag VARCHAR(50) NOT NULL, img_rate VARCHAR(20) NOT NULL, img_commentsVARCHAR(50) NOT NULL, KEY (img_id); Thanks for any help. nick
Re: Images Table
On Thursday 20 July 2006 07:19 am, Nicholas Vettese wrote: img_idINTNOT NULL auto_increment PRIMARY KEY, user_id INTNOT NULL, location VARCHAR(255) NOT NULL, imgtype VARCHAR(20) NOT NULL, img_tag VARCHAR(50) NOT NULL, img_rate VARCHAR(20) NOT NULL, good img_commentsVARCHAR(50) NOT NULL, bzzt, bad! Note here comment(s). You have a 1 to many relationship, as one image can have many comments. What you need to do is have a separate table for that: CREATE TABLE image_comments ( id SERIAL PRIMARY KEY, comment TEXT NOT NULL, image_id INT NOT NULL, CONSTRAINT `foreign_images_comments` FOREIGN KEY `foreign_images_comments` (`image_id`) REFERENCES `[image-table]` `img_id` ON DELETE CASCADE ); then: SELECT comment FROM image_comments WHERE image_id = [image_id_here]; Why? Think about how you'd need to add comments. You'd have 2 choices: 1) Shove all the comments in one column (get ready for a HUGE table) 2) Create a separate image row for each comment (lots of duplicate data, bad!) KEY (img_id); Not needed, you already declared it a key above (PRIMARY KEY) Thanks for any help. nick -- Chris White PHP Programmer/DBoo Interfuel -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Best Configuratuion ( my.cnf ) for a DB with many users and largecolumns ( Images in BLOB Columns ) on a Website
Hello. A lot of depends on the type of your queries. Find out which of them make the maximum load on the server and then tune your configuration. ESV Media GmbH wrote: Hey, what do you think is the best configuration ( my.cnf ) for running a database, which many users access at the same time ( Website - Portal ). We´ve also saved our Pictures ( nearly 3.500 rows ) in our database. Every coloumn is round about 60-70 Kbyte, so i had to use mediumblob columns. There are 116 Tables and we have a primary key and an index on every table and use them in ( i hope so ;-) ) every statement. Here i´ve a my.cnf from another website. Would that be an good configuration ? Thanks in advance Marco My.cnf : # The MySQL server [mysqld] port= 3307 socket = /tmp/mysql.sock skip-locking key_buffer_size = 256M max_allowed_packet = 1M table_cache = 500 sort_buffer_size = 24M net_buffer_length = 8K read_buffer_size = 1M read_rnd_buffer_size = 256K myisam_sort_buffer_size = 24M record_buffer=1M log-slow-queries long_query_time = 3 query_cache_size = 512M max_connections = 500 join_buffer_size = 16M [mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash # Remove the next comment character if you are not familiar with SQL #safe-updates [isamchk] key_buffer = 25M sort_buffer_size = 25M read_buffer = 6M write_buffer = 6M [myisamchk] key_buffer = 25M sort_buffer_size = 25M read_buffer = 6M write_buffer = 6M [mysqlhotcopy] interactive-timeout -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.NET http://www.ensita.net/ __ ___ ___ __ / |/ /_ __/ __/ __ \/ /Gleb Paharenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET ___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Best Configuratuion ( my.cnf ) for a DB with many users and large columns ( Images in BLOB Columns ) on a Website
Hey, what do you think is the best configuration ( my.cnf ) for running a database, which many users access at the same time ( Website - Portal ). We´ve also saved our Pictures ( nearly 3.500 rows ) in our database. Every coloumn is round about 60-70 Kbyte, so i had to use mediumblob columns. There are 116 Tables and we have a primary key and an index on every table and use them in ( i hope so ;-) ) every statement. Here i´ve a my.cnf from another website. Would that be an good configuration ? Thanks in advance Marco My.cnf : # The MySQL server [mysqld] port= 3307 socket = /tmp/mysql.sock skip-locking key_buffer_size = 256M max_allowed_packet = 1M table_cache = 500 sort_buffer_size = 24M net_buffer_length = 8K read_buffer_size = 1M read_rnd_buffer_size = 256K myisam_sort_buffer_size = 24M record_buffer=1M log-slow-queries long_query_time = 3 query_cache_size = 512M max_connections = 500 join_buffer_size = 16M [mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash # Remove the next comment character if you are not familiar with SQL #safe-updates [isamchk] key_buffer = 25M sort_buffer_size = 25M read_buffer = 6M write_buffer = 6M [myisamchk] key_buffer = 25M sort_buffer_size = 25M read_buffer = 6M write_buffer = 6M [mysqlhotcopy] interactive-timeout -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Best Configuratuion ( my.cnf ) for a DB with many users and large columns ( Images in BLOB Columns ) on a Website]
Hey, what do you think is the best configuration ( my.cnf ) for running a database, which many users access at the same time ( Website - Portal ). We´ve also saved our Pictures ( nearly 3.500 rows ) in our database. Every coloumn is round about 60-70 Kbyte, so i had to use mediumblob columns. There are 116 Tables and we have a primary key and an index on every table and use them in ( i hope so ;-) ) every statement. Here i´ve a my.cnf from another website. Would that be an good configuration ? Thanks in advance Marco My.cnf : # The MySQL server [mysqld] port= 3307 socket = /tmp/mysql.sock skip-locking key_buffer_size = 256M max_allowed_packet = 1M table_cache = 500 sort_buffer_size = 24M net_buffer_length = 8K read_buffer_size = 1M read_rnd_buffer_size = 256K myisam_sort_buffer_size = 24M record_buffer=1M log-slow-queries long_query_time = 3 query_cache_size = 512M max_connections = 500 join_buffer_size = 16M [mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash # Remove the next comment character if you are not familiar with SQL #safe-updates [isamchk] key_buffer = 25M sort_buffer_size = 25M read_buffer = 6M write_buffer = 6M [myisamchk] key_buffer = 25M sort_buffer_size = 25M read_buffer = 6M write_buffer = 6M [mysqlhotcopy] interactive-timeout -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: upload images / mp3 more Than 1 MB capacity ---- please help
For an PHP example of how to import data getting around max_packet_size, performance, etc. issues.. Be sure to read this article. Also linked from: http://dev.mysql.com/doc/refman/4.1/en/blob.html Article @ http://php.dreamwerx.net/forums/viewtopic.php?t=6 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: upload images / mp3 more Than 1 MB capacity ---- please help
Dan Buettner wrote: I tend to disagree - at my place of employment, a newspaper, we have hundreds of gigabytes of BLOB data (ad and page layouts digital artwork) stored in SQL databases. Granted we are using Sybase for that and not MySQL but there are a lot of advantages to it - access control, change control and tracking, easy insertion and deletion, and access from any client right through the database driver so you can repurpose content more easily. There are situations where it might be useful to store large amounts of binary data in a database. For most situations the best solution is to store metadata about the file in a database and store the file itself on a file system. There have been lots of discussions about it on this list in the past. From those discussions one could conclude that in general a file system is best for storing (large) files and the metadata about these files can live in a database. But there are situations where storing large files in a database has more advantages. Kind regards, Jigal. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
upload images / mp3 more Than 1 MB capacity ---- please help
hi , I have crerated a mysql database to store images , mp3 , video files..etc. In my first stage i stored images as jpg , gif . But when i try to store little but huge gif files it wont store . I used the script as follows to upload images, html head titleUpload File To MySQL Database/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 style type=text/css !-- .box { font-family: Arial, Helvetica, sans-serif; font-size: 12px; border: 1px solid #00; } -- /style /head body ? if(isset($_POST['upload'])) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileType = $_FILES['userfile']['type']; $fileSize = $_FILES['userfile']['size']; $fp = fopen($tmpName, 'r'); $content = fread($fp, $fileSize); $content = addslashes($content); fclose($fp); if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); } include 'library/config.php'; include 'library/opendb.php'; $query = INSERT INTO upload (name, type, size, content ) . VALUES ('$fileName', '$fileType','$fileSize', '$content'); mysql_query($query) or die('Error, query failed'); include 'library/closedb.php'; echo brFile $fileName uploadedbr; } ? form action= method=post enctype=multipart/form-data name=uploadform table width=350 border=0 cellpadding=1 cellspacing=1 class=box tr td width=246input type=hidden name=MAX_FILE_SIZE value=200input name=userfile type=file class=box id=userfile /td td width=80input name=upload type=submit class=box id=upload value= Upload /td /tr /table /form /body /html 56Kb , 75 Kb files are accept to store , but more that 1 MB we cant upload. It wont give any error messages . But that particular data wont displayed. so , this is a big problem for me . i couldnt sorted out yet . I used mysqlcc and sqlYOG as well to upload images ( contents ). in like this situations how can we work with mp3 and such huge files please . help me very very urgent Thanx in advance, Kane. - Yahoo! Music Unlimited - Access over 1 million songs. Try it free.
Re: upload images / mp3 more Than 1 MB capacity ---- please help
Kane Wilson wrote: But when i try to store little but huge gif files it wont store . First of all, use the method described at http://www.php.net/manual/en/features.file-upload.php for a safe way to handle file uploads. It could be that you run into a server limit which will show up if you use that method. I do think that you exceeded the max_allowed_packet size for MySQL queries which has a default value of 1048576 (=1MB). You can increase this number (must be done in both client and server!!), but it is usually best to store huge files in a file system and not in a database. Kind regards, Jigal. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: upload images / mp3 more Than 1 MB capacity ---- please help
thanx for the reply , usually , i uploading jpg and gif files into mysql database , there is no any issue. we can display them correctly. when i try to upload such huge mp3 files and some .jar files into the databse , i used mysqlcc GUI and SQLYOG GUI , from those interfaces also giving troubles. contents wont stored. my requrement is any how keep the contents , in the mysql database, i have high performance machine. so then i'm not worry about perforamnce. please , let me know how could be the way to store such files in a mysql databse ??? please help Jigal van Hemert [EMAIL PROTECTED] wrote: Kane Wilson wrote: But when i try to store little but huge gif files it wont store . First of all, use the method described at http://www.php.net/manual/en/features.file-upload.php for a safe way to handle file uploads. It could be that you run into a server limit which will show up if you use that method. I do think that you exceeded the max_allowed_packet size for MySQL queries which has a default value of 1048576 (=1MB). You can increase this number (must be done in both client and server!!), but it is usually best to store huge files in a file system and not in a database. Kind regards, Jigal. - Yahoo! Music Unlimited - Access over 1 million songs. Try it free.
Re: upload images / mp3 more Than 1 MB capacity ---- please help
AS JIGAL SAID : make sure you are not creating an INSERT statement bigger than the max_allowed_packet setting for both your destination server and your client library (whichever ones you are using). If you attempt to create a packet that is too large, the server will _ignore_ it. Because the packet (SQL statement) is too large, it is considered malformed and any processing of it will be aborted. http://dev.mysql.com/doc/refman/5.0/en/packet-too-large.html http://dev.mysql.com/doc/refman/5.0/en/memory-use.html http://dev.mysql.com/doc/refman/5.0/en/server-parameters.html Shawn Green Database Administrator Unimin Corporation - Spruce Pine Kane Wilson [EMAIL PROTECTED] wrote on 10/13/2005 09:25:24 AM: thanx for the reply , usually , i uploading jpg and gif files into mysql database , there is no any issue. we can display them correctly. when i try to upload such huge mp3 files and some .jar files into the databse , i used mysqlcc GUI and SQLYOG GUI , from those interfaces also giving troubles. contents wont stored. my requrement is any how keep the contents , in the mysql database, i have high performance machine. so then i'm not worry about perforamnce. please , let me know how could be the way to store such files in a mysql databse ??? please help Jigal van Hemert [EMAIL PROTECTED] wrote: Kane Wilson wrote: But when i try to store little but huge gif files it wont store . First of all, use the method described at http://www.php.net/manual/en/features.file-upload.php for a safe way to handle file uploads. It could be that you run into a server limit which will show up if you use that method. I do think that you exceeded the max_allowed_packet size for MySQL queries which has a default value of 1048576 (=1MB). You can increase this number (must be done in both client and server!!), but it is usually best to store huge files in a file system and not in a database. Kind regards, Jigal. - Yahoo! Music Unlimited - Access over 1 million songs. Try it free.
Re: upload images / mp3 more Than 1 MB capacity ---- please help
I tend to disagree - at my place of employment, a newspaper, we have hundreds of gigabytes of BLOB data (ad and page layouts digital artwork) stored in SQL databases. Granted we are using Sybase for that and not MySQL but there are a lot of advantages to it - access control, change control and tracking, easy insertion and deletion, and access from any client right through the database driver so you can repurpose content more easily. I have stored smaller amounts of BLOB data in MySQL for side projects in the past, without trouble. Do understand though that storing BLOB data in the db will impact your table optimization and repair times as well as backup/recover times. You might also want to plan ahead and devise a scheme to spread the data among several tables, to allow optimization of just one table a day (for example) and even to allow you to split storage across multiple devices should your database get too large. Dan At 3:09 PM +0200 10/13/05, Jigal van Hemert wrote: Kane Wilson wrote: But when i try to store little but huge gif files it wont store . First of all, use the method described at http://www.php.net/manual/en/features.file-upload.php for a safe way to handle file uploads. It could be that you run into a server limit which will show up if you use that method. I do think that you exceeded the max_allowed_packet size for MySQL queries which has a default value of 1048576 (=1MB). You can increase this number (must be done in both client and server!!), but it is usually best to store huge files in a file system and not in a database. Kind regards, Jigal. -- 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]
Need help in storing and retreving images
__ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
need help in stroing and retreving images from database
Sir , Iam working on Mysql5.0 version. Can I store .jpeg or .png or .gif etc imagefiles in database. If so where can I get the tutorials or sample code to insert and retrive the images from mysql database. Any help is welcome. Thanking you , Sreedhar __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: need help in stroing and retreving images from database
Hi, all binary docs can be inserted in blob columns. see this link for a php insert method :http://www.phpcs.com/code.aspx?ID=30945 this is mysql doc : http://dev.mysql.com/doc/mysql/en/blob.html Mathias Selon madderla sreedhar [EMAIL PROTECTED]: Sir , Iam working on Mysql5.0 version. Can I store .jpeg or .png or .gif etc imagefiles in database. If so where can I get the tutorials or sample code to insert and retrive the images from mysql database. Any help is welcome. Thanking you , Sreedhar __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.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]
Inserting Other Binary data into DB (NOT IMAGES)
Title: Inserting Other Binary data into DB (NOT IMAGES) Good afternoon all, I have a db (gasp!) that is holding images in a BLOB field already. I can upload and retrieve on the fly - no problems. Now I am looking at inserting binary data such as M$Word Documents (.doc and .rtf), XML (which I have already been exposed to on this list), and PDF files. I have read somewhere that it can be done, however I have not been able to make it work with MySQL. NOTES: -- I can make it work with Acce$$ if I use the OLE Object, but that is not my goal. -- I do not want to store the resulting FSO /path/to/file structure. -- My goal is to try to insert them into the database. DB NOTES: -- MySQL 4.1.10 -- Linux RHEL 3.2 (production) -- Slave on Win2k3 also running 4.1.10 (devel) -- MyODBC 3.51.10 on Win2k3 -- ASP 3.0 with IIS and Apache/Sun One ASP Any help or insight will be greatly appreciated. Thanks! J.R. smime.p7s Description: S/MIME cryptographic signature
Re: Inserting Other Binary data into DB (NOT IMAGES)
Inserting Other Binary data into DB (NOT IMAGES)Inserting images in no different compared to inserting PDFs. What is your problem? What have you tried so far? With regards, Martijn Tonies Database Workbench - developer tool for InterBase, Firebird, MySQL MS SQL Server Upscene Productions http://www.upscene.com Good afternoon all, I have a db (gasp!) that is holding images in a BLOB field already. I can upload and retrieve on the fly - no problems. Now I am looking at inserting binary data such as M$Word Documents (.doc and .rtf), XML (which I have already been exposed to on this list), and PDF files. I have read somewhere that it can be done, however I have not been able to make it work with MySQL. NOTES: -- I can make it work with Acce$$ if I use the OLE Object, but that is not my goal. -- I do not want to store the resulting FSO /path/to/file structure. -- My goal is to try to insert them into the database. DB NOTES: -- MySQL 4.1.10 -- Linux RHEL 3.2 (production) -- Slave on Win2k3 also running 4.1.10 (devel) -- MyODBC 3.51.10 on Win2k3 -- ASP 3.0 with IIS and Apache/Sun One ASP Any help or insight will be greatly appreciated. Thanks! J.R. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Inserting Other Binary data into DB (NOT IMAGES)
Since this post, I have been able to enter a PDF file into the DB using MySQLCC / MySQL CLI and INSERT / UPDATE statements. Now my issue is the ASP / aspUpload. That is not appropriate for this list. Thanks anyways! J.R. -Original Message- From: Martijn Tonies [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 01, 2005 5:09 PM To: [EMAIL PROTECTED]; mysql Subject: Re: Inserting Other Binary data into DB (NOT IMAGES) Inserting Other Binary data into DB (NOT IMAGES)Inserting images in no different compared to inserting PDFs. What is your problem? What have you tried so far? With regards, Martijn Tonies Database Workbench - developer tool for InterBase, Firebird, MySQL MS SQL Server Upscene Productions http://www.upscene.com Good afternoon all, I have a db (gasp!) that is holding images in a BLOB field already. I can upload and retrieve on the fly - no problems. Now I am looking at inserting binary data such as M$Word Documents (.doc and .rtf), XML (which I have already been exposed to on this list), and PDF files. I have read somewhere that it can be done, however I have not been able to make it work with MySQL. NOTES: -- I can make it work with Acce$$ if I use the OLE Object, but that is not my goal. -- I do not want to store the resulting FSO /path/to/file structure. -- My goal is to try to insert them into the database. DB NOTES: -- MySQL 4.1.10 -- Linux RHEL 3.2 (production) -- Slave on Win2k3 also running 4.1.10 (devel) -- MyODBC 3.51.10 on Win2k3 -- ASP 3.0 with IIS and Apache/Sun One ASP Any help or insight will be greatly appreciated. Thanks! J.R. smime.p7s Description: S/MIME cryptographic signature
Re: Images to MySql Database in PHP or JAVA
Hi, Have you try google ? http://www.google.fr/search?hl=frq=storing+image+in+mysqlbtnG=Recherche+Googlemeta= I see pretty much a lot of stuff there ;) btw, storing image in a table in considering a bad practice, let the filesystem handle it it does it more efficiently. I would suggesdt to write the image on the disk, and then store the path in you db with useful thing like image format, width, height, etc... HIMH. Christopher Molnar wrote: Hello list- I am programing both in Java and PHP. Can anyone point me to sample code for either on saving an image to a table? Thanks, -Chris -- Philippe Poelvoorde COS Trading Ltd. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Images to MySql Database in PHP or JAVA
Hello list- I am programing both in Java and PHP. Can anyone point me to sample code for either on saving an image to a table? Thanks, -Chris -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Images to MySql Database in PHP or JAVA
Dear member,you can visit: http://dev.mysql.com/doc/connector/j/en/index.html http://dev.mysql.com/doc/mysql/en/php.html Hello list- I am programing both in Java and PHP. Can anyone point me to sample code for either on saving an image to a table? Thanks, -Chris -- 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]
Re: Trouble w/ mysqldump (images attached)
Hello. [mysqldump] default_character_set = latin1 [EMAIL PROTECTED] wrote: amazing.. I failed to see that in the last msg - but that seemed to do the trick - The images appear correctly now.. is there anyway in my.cnf to tell it to always use the command?? Thanks much for the help! In a message dated 1/11/2005 4:48:27 AM Eastern Standard Time, Gleb Paharenko [EMAIL PROTECTED] writes: -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.NET http://www.ensita.net/ __ ___ ___ __ / |/ /_ __/ __/ __ \/ /Gleb Paharenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET ___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Trouble w/ mysqldump (images attached)
Thanks for all your help Gleb! I Appreciate all your hard work! In a message dated 1/12/2005 5:31:19 AM Eastern Standard Time, Gleb Paharenko [EMAIL PROTECTED] writes: Hello. [mysqldump] default_character_set = latin1 [EMAIL PROTECTED] wrote: amazing.. I failed to see that in the last msg - but that seemed to do the trick - The images appear correctly now.. is there anyway in my.cnf to tell it to always use the command?? Thanks much for the help! In a message dated 1/11/2005 4:48:27 AM Eastern Standard Time, Gleb Paharenko [EMAIL PROTECTED] writes: -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.NET http://www.ensita.net/ __ ___ ___ __ / |/ /_ __/ __/ __ \/ / Gleb Paharenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET ___/ www.mysql.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]
Re: Trouble w/ mysqldump (images attached)
Hello. Have you tried to perform the dump using --default-character-set=latin1 option and then restore data from it? [EMAIL PROTECTED] wrote: Hello, thanks for helping! Here is the output of the requested statements on live database: SHOW CREATE TABLE avatardata; | customavatar | CREATE TABLE `customavatar` ( `userid` int(10) unsigned NOT NULL default '0', `avatardata` mediumtext NOT NULL, `dateline` int(10) unsigned NOT NULL default '0', `filename` varchar(100) NOT NULL default '', PRIMARY KEY (`userid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 | SHOW CREATE DATABASE 'put the name of the avatar database'; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''customavatar'' at line 1 SHOW VARIABLES LIKE '%char%'; +--++ | Variable_name| Value | +--++ | character_set_client | latin1 | | character_set_connection | latin1 | | character_set_database | latin1 | | character_set_results| latin1 | | character_set_server | latin1 | | character_set_system | utf8 | | character_sets_dir | /usr/local/mysql/share/mysql/charsets/ | +--++ Here is my my.cnf file [Removed commented out sections]: [client] #password = your_password port= 3306 socket = /var/lib/mysql/mysql.sock # Here follows entries for some specific programs # The MySQL server [mysqld] port= 3306 socket = /var/lib/mysql/mysql.sock skip-locking key_buffer = 16M max_allowed_packet = 1M table_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M datadir=/var/lib/mysql old-passwords log-bin server-id = 1 [mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash # Remove the next comment character if you are not familiar with SQL #safe-updates [isamchk] key_buffer = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M [myisamchk] key_buffer = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M [mysqlhotcopy] interactive-timeout [mysql.server] user=mysql basedir=/var/lib [safe_mysqld] err-log=/var/log/mysqld.log -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.NET http://www.ensita.net/ __ ___ ___ __ / |/ /_ __/ __/ __ \/ /Gleb Paharenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET ___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Trouble w/ mysqldump (images attached)
amazing.. I failed to see that in the last msg - but that seemed to do the trick - The images appear correctly now.. is there anyway in my.cnf to tell it to always use the command?? Thanks much for the help! In a message dated 1/11/2005 4:48:27 AM Eastern Standard Time, Gleb Paharenko [EMAIL PROTECTED] writes: Hello. Have you tried to perform the dump using --default-character-set=latin1 option and then restore data from it? [EMAIL PROTECTED] wrote: Hello, thanks for helping! Here is the output of the requested statements on live database: SHOW CREATE TABLE avatardata; | customavatar | CREATE TABLE `customavatar` ( `userid` int(10) unsigned NOT NULL default '0', `avatardata` mediumtext NOT NULL, `dateline` int(10) unsigned NOT NULL default '0', `filename` varchar(100) NOT NULL default '', PRIMARY KEY (`userid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 | SHOW CREATE DATABASE 'put the name of the avatar database'; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''customavatar'' at line 1 SHOW VARIABLES LIKE '%char%'; +--++ | Variable_name | Value | +--++ | character_set_client | latin1 | | character_set_connection | latin1 | | character_set_database | latin1 | | character_set_results | latin1 | | character_set_server | latin1 | | character_set_system | utf8 | | character_sets_dir | /usr/local/mysql/share/mysql/charsets/ | +--++ Here is my my.cnf file [Removed commented out sections]: [client] #password = your_password port = 3306 socket = /var/lib/mysql/mysql.sock # Here follows entries for some specific programs # The MySQL server [mysqld] port = 3306 socket = /var/lib/mysql/mysql.sock skip-locking key_buffer = 16M max_allowed_packet = 1M table_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M datadir=/var/lib/mysql old-passwords log-bin server-id = 1 [mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash # Remove the next comment character if you are not familiar with SQL #safe-updates [isamchk] key_buffer = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M [myisamchk] key_buffer = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M [mysqlhotcopy] interactive-timeout [mysql.server] user=mysql basedir=/var/lib [safe_mysqld] err-log=/var/log/mysqld.log -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.NET http://www.ensita.net/ __ ___ ___ __ / |/ /_ __/ __/ __ \/ / Gleb Paharenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET ___/ www.mysql.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]
Re: Trouble w/ mysqldump (images attached)
Hello, thanks for helping! Here is the output of the requested statements on live database: SHOW CREATE TABLE avatardata; | customavatar | CREATE TABLE `customavatar` ( `userid` int(10) unsigned NOT NULL default '0', `avatardata` mediumtext NOT NULL, `dateline` int(10) unsigned NOT NULL default '0', `filename` varchar(100) NOT NULL default '', PRIMARY KEY (`userid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 | SHOW CREATE DATABASE 'put the name of the avatar database'; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''customavatar'' at line 1 SHOW VARIABLES LIKE '%char%'; +--++ | Variable_name| Value | +--++ | character_set_client | latin1 | | character_set_connection | latin1 | | character_set_database | latin1 | | character_set_results| latin1 | | character_set_server | latin1 | | character_set_system | utf8 | | character_sets_dir | /usr/local/mysql/share/mysql/charsets/ | +--++ Here is my my.cnf file [Removed commented out sections]: [client] #password = your_password port= 3306 socket = /var/lib/mysql/mysql.sock # Here follows entries for some specific programs # The MySQL server [mysqld] port= 3306 socket = /var/lib/mysql/mysql.sock skip-locking key_buffer = 16M max_allowed_packet = 1M table_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M datadir=/var/lib/mysql old-passwords log-bin server-id = 1 [mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash # Remove the next comment character if you are not familiar with SQL #safe-updates [isamchk] key_buffer = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M [myisamchk] key_buffer = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M [mysqlhotcopy] interactive-timeout [mysql.server] user=mysql basedir=/var/lib [safe_mysqld] err-log=/var/log/mysqld.log In a message dated 1/8/2005 10:52:13 AM Eastern Standard Time, Gleb Paharenko [EMAIL PROTECTED] writes: Hello. mysqldump usually produced SET NAMES utf8 at the begining of the dump file. The clues may be in this. Send us the output of such statements: SHOW CREATE TABLE avatardata; SHOW CREATE DATABASE 'put the name of the avatar database'; SHOW VARIABLES LIKE '%char%'; and your my.cnf file. Use --default-character-set=latin1 command line option for mysqldump. [EMAIL PROTECTED] wrote: Hi Dr. The avatars still show fine on 4.18a -- but the problem occurs when I actually do a dump and reimport the dump file. That's when something goes array.. Kinda weird if you ask me.. I wish that vBulletin wouldn't actually hard code the binary in a table, lol.. It's got me totally baffled! :) In a message dated 1/7/2005 4:02:04 AM Eastern Standard Time, Dr. Frank Ullrich [EMAIL PROTECTED] writes: Hi, [EMAIL PROTECTED] schrieb: Hi Tom, Thanks for the reply! I show the following information for my DB, and shows the same for both the 3.23 DB And the 4.18a DB Field Type Collation avatardata mediumtext latin1_swedish_ci I pasted a data table from the bad avatar and the good avatar to a file differential program, there was no differential at all that the system found.. that seems to point towards a client issue. Which client do you use to look at the atachments (I think I have heard about problems with php and 4.1.x on this list recently)? As a further test I would suggest that you take the data table (.myd file?) from the 4.1.8 db and copy it into a __test__ 3.23 db replacing the data table there (it's myisam isn't it?). See if the avatars are ok when you read them from the 3.23 db. Regards, Frank. I'm not too sure where or what to do to change this information? Do you mean that I recompile MySQL using different ./configure commands? Thanks Tom! [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote on Thursday, January 06, 2005 4:57 PM: Sorry, forgot the attachments. These are the same exact two avatars from the same user, using my 3.23 backup, for the good avatar, then the 4.18 bad avatar Looks like a character set issue - what's the column type, BLOB or TEXT or something in between? This could be due to the server converting UTF-8 into a different character set. Characters such as 0x8F (143 decimal) and 0x8D are being converted into 0x3F, which is ?
Re: Trouble w/ mysqldump (images attached)
Hello. mysqldump usually produced SET NAMES utf8 at the begining of the dump file. The clues may be in this. Send us the output of such statements: SHOW CREATE TABLE avatardata; SHOW CREATE DATABASE 'put the name of the avatar database'; SHOW VARIABLES LIKE '%char%'; and your my.cnf file. Use --default-character-set=latin1 command line option for mysqldump. [EMAIL PROTECTED] wrote: Hi Dr. The avatars still show fine on 4.18a -- but the problem occurs when I actually do a dump and reimport the dump file. That's when something goes array.. Kinda weird if you ask me.. I wish that vBulletin wouldn't actually hard code the binary in a table, lol.. It's got me totally baffled! :) In a message dated 1/7/2005 4:02:04 AM Eastern Standard Time, Dr. Frank Ullrich [EMAIL PROTECTED] writes: Hi, [EMAIL PROTECTED] schrieb: Hi Tom, Thanks for the reply! I show the following information for my DB, and shows the same for both the 3.23 DB And the 4.18a DB Field Type Collation avatardata mediumtext latin1_swedish_ci I pasted a data table from the bad avatar and the good avatar to a file differential program, there was no differential at all that the system found.. that seems to point towards a client issue. Which client do you use to look at the atachments (I think I have heard about problems with php and 4.1.x on this list recently)? As a further test I would suggest that you take the data table (.myd file?) from the 4.1.8 db and copy it into a __test__ 3.23 db replacing the data table there (it's myisam isn't it?). See if the avatars are ok when you read them from the 3.23 db. Regards, Frank. I'm not too sure where or what to do to change this information? Do you mean that I recompile MySQL using different ./configure commands? Thanks Tom! [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote on Thursday, January 06, 2005 4:57 PM: Sorry, forgot the attachments. These are the same exact two avatars from the same user, using my 3.23 backup, for the good avatar, then the 4.18 bad avatar Looks like a character set issue - what's the column type, BLOB or TEXT or something in between? This could be due to the server converting UTF-8 into a different character set. Characters such as 0x8F (143 decimal) and 0x8D are being converted into 0x3F, which is ? and often indicates that the character does not exist in the target collation. Basically, MySQL is treating the content as text, and replacing characters which it doesn't understand with ?. Try using a different collation or character set, and importing again? Unfortunately, the conversion is not reversible - a set of characters have been replaced with a single character, so although the image is the same binary size, some of the data has been permanently lost unless you can restore from the backup. cheers, Tom In a message dated 1/6/2005 12:48:28 PM Eastern Standard Time, Tom Molesworth [EMAIL PROTECTED] writes: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote on Thursday, January 06, 2005 4:57 PM: Sorry, forgot the attachments. These are the same exact two avatars from the same user, using my 3.23 backup, for the good avatar, then the 4.18 bad avatar Looks like a character set issue - what's the column type, BLOB or TEXT or something in between? This could be due to the server converting UTF-8 into a different character set. Characters such as 0x8F (143 decimal) and 0x8D are being converted into 0x3F, which is ? and often indicates that the character does not exist in the target collation. Basically, MySQL is treating the content as text, and replacing characters which it doesn't understand with ?. Try using a different collation or character set, and importing again? Unfortunately, the conversion is not reversible - a set of characters have been replaced with a single character, so although the image is the same binary size, some of the data has been permanently lost unless you can restore from the backup. cheers, Tom -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.NET http://www.ensita.net/ __ ___ ___ __ / |/ /_ __/ __/ __ \/ /Gleb Paharenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET ___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Trouble w/ mysqldump (images attached)
Hi there, [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote on Thursday, January 06, 2005 7:19 PM: Thanks for the reply! I show the following information for my DB, and shows the same for both the 3.23 DB And the 4.18a DB Field Type Collation avatardata mediumtext latin1_swedish_ci It'd be better to use a BLOB, I think, because this would avoid the translation issues. Other alternatives worth pursuing: * Add the BINARY flag to the field - avatardata MEDIUMTEXT BINARY, for example. * Use a different collation, preferably one that's not case insensitive (the 'ci' part of the collation) * Use latin1_bin on the new DB (and you might need to use _latin1_bindata instead of just data when doing inserts) http://dev.mysql.com/doc/mysql/en/Charset-literal.html * Force the collation type, using the COLLATION keyword, as in http://dev.mysql.com/doc/mysql/en/Charset-collate.html I pasted a data table from the bad avatar and the good avatar to a file differential program, there was no differential at all that the system found.. If you want to send me (directly, rather than via the list) one of the records, as taken from both the bad and good versions, I could take a look for you. The binary files differ, so I'm not too sure what data is being used when you did the paste-and-compare. I'm not too sure where or what to do to change this information? Do you mean that I recompile MySQL using different ./configure commands? Shouldn't need to recompile, as long as you have the right charactersets available (which should be the default, I think). cheers, Tom -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Trouble w/ mysqldump (images attached)
Hi, [EMAIL PROTECTED] schrieb: Hi Tom, Thanks for the reply! I show the following information for my DB, and shows the same for both the 3.23 DB And the 4.18a DB Field Type Collation avatardata mediumtext latin1_swedish_ci I pasted a data table from the bad avatar and the good avatar to a file differential program, there was no differential at all that the system found.. that seems to point towards a client issue. Which client do you use to look at the atachments (I think I have heard about problems with php and 4.1.x on this list recently)? As a further test I would suggest that you take the data table (.myd file?) from the 4.1.8 db and copy it into a __test__ 3.23 db replacing the data table there (it's myisam isn't it?). See if the avatars are ok when you read them from the 3.23 db. Regards, Frank. I'm not too sure where or what to do to change this information? Do you mean that I recompile MySQL using different ./configure commands? Thanks Tom! [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote on Thursday, January 06, 2005 4:57 PM: Sorry, forgot the attachments. These are the same exact two avatars from the same user, using my 3.23 backup, for the good avatar, then the 4.18 bad avatar Looks like a character set issue - what's the column type, BLOB or TEXT or something in between? This could be due to the server converting UTF-8 into a different character set. Characters such as 0x8F (143 decimal) and 0x8D are being converted into 0x3F, which is ? and often indicates that the character does not exist in the target collation. Basically, MySQL is treating the content as text, and replacing characters which it doesn't understand with ?. Try using a different collation or character set, and importing again? Unfortunately, the conversion is not reversible - a set of characters have been replaced with a single character, so although the image is the same binary size, some of the data has been permanently lost unless you can restore from the backup. cheers, Tom In a message dated 1/6/2005 12:48:28 PM Eastern Standard Time, Tom Molesworth [EMAIL PROTECTED] writes: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote on Thursday, January 06, 2005 4:57 PM: Sorry, forgot the attachments. These are the same exact two avatars from the same user, using my 3.23 backup, for the good avatar, then the 4.18 bad avatar Looks like a character set issue - what's the column type, BLOB or TEXT or something in between? This could be due to the server converting UTF-8 into a different character set. Characters such as 0x8F (143 decimal) and 0x8D are being converted into 0x3F, which is ? and often indicates that the character does not exist in the target collation. Basically, MySQL is treating the content as text, and replacing characters which it doesn't understand with ?. Try using a different collation or character set, and importing again? Unfortunately, the conversion is not reversible - a set of characters have been replaced with a single character, so although the image is the same binary size, some of the data has been permanently lost unless you can restore from the backup. cheers, Tom -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- Dr. Frank Ullrich, DBA Netzwerkadministration Heise Zeitschriften Verlag GmbH Co KG, Helstorfer Str. 7, D-30625 Hannover E-Mail: [EMAIL PROTECTED] Phone: +49 511 5352 587; FAX: +49 511 5352 538 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Trouble w/ mysqldump (images attached)
I have reinstalled the v3 RPM again to my system, and used one of my original backups from that same version. In 3.23 there is no 'collation' field.. I wonder if that is the problem?? I am going to change it to latein1_bin to see what happens next.. Thanks! I'll let you know! In a message dated 1/7/2005 3:44:25 AM Eastern Standard Time, Tom Molesworth [EMAIL PROTECTED] writes: Hi there, [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote on Thursday, January 06, 2005 7:19 PM: Thanks for the reply! I show the following information for my DB, and shows the same for both the 3.23 DB And the 4.18a DB Field Type Collation avatardata mediumtext latin1_swedish_ci It'd be better to use a BLOB, I think, because this would avoid the translation issues. Other alternatives worth pursuing: * Add the BINARY flag to the field - avatardata MEDIUMTEXT BINARY, for example. * Use a different collation, preferably one that's not case insensitive (the 'ci' part of the collation) * Use latin1_bin on the new DB (and you might need to use _latin1_bindata instead of just data when doing inserts) http://dev.mysql.com/doc/mysql/en/Charset-literal.html * Force the collation type, using the COLLATION keyword, as in http://dev.mysql.com/doc/mysql/en/Charset-collate.html I pasted a data table from the bad avatar and the good avatar to a file differential program, there was no differential at all that the system found.. If you want to send me (directly, rather than via the list) one of the records, as taken from both the bad and good versions, I could take a look for you. The binary files differ, so I'm not too sure what data is being used when you did the paste-and-compare. I'm not too sure where or what to do to change this information? Do you mean that I recompile MySQL using different ./configure commands? Shouldn't need to recompile, as long as you have the right charactersets available (which should be the default, I think). cheers, Tom -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Trouble w/ mysqldump (images attached)
Hi Dr. The avatars still show fine on 4.18a -- but the problem occurs when I actually do a dump and reimport the dump file. That's when something goes array.. Kinda weird if you ask me.. I wish that vBulletin wouldn't actually hard code the binary in a table, lol.. It's got me totally baffled! :) In a message dated 1/7/2005 4:02:04 AM Eastern Standard Time, Dr. Frank Ullrich [EMAIL PROTECTED] writes: Hi, [EMAIL PROTECTED] schrieb: Hi Tom, Thanks for the reply! I show the following information for my DB, and shows the same for both the 3.23 DB And the 4.18a DB Field Type Collation avatardata mediumtext latin1_swedish_ci I pasted a data table from the bad avatar and the good avatar to a file differential program, there was no differential at all that the system found.. that seems to point towards a client issue. Which client do you use to look at the atachments (I think I have heard about problems with php and 4.1.x on this list recently)? As a further test I would suggest that you take the data table (.myd file?) from the 4.1.8 db and copy it into a __test__ 3.23 db replacing the data table there (it's myisam isn't it?). See if the avatars are ok when you read them from the 3.23 db. Regards, Frank. I'm not too sure where or what to do to change this information? Do you mean that I recompile MySQL using different ./configure commands? Thanks Tom! [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote on Thursday, January 06, 2005 4:57 PM: Sorry, forgot the attachments. These are the same exact two avatars from the same user, using my 3.23 backup, for the good avatar, then the 4.18 bad avatar Looks like a character set issue - what's the column type, BLOB or TEXT or something in between? This could be due to the server converting UTF-8 into a different character set. Characters such as 0x8F (143 decimal) and 0x8D are being converted into 0x3F, which is ? and often indicates that the character does not exist in the target collation. Basically, MySQL is treating the content as text, and replacing characters which it doesn't understand with ?. Try using a different collation or character set, and importing again? Unfortunately, the conversion is not reversible - a set of characters have been replaced with a single character, so although the image is the same binary size, some of the data has been permanently lost unless you can restore from the backup. cheers, Tom In a message dated 1/6/2005 12:48:28 PM Eastern Standard Time, Tom Molesworth [EMAIL PROTECTED] writes: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote on Thursday, January 06, 2005 4:57 PM: Sorry, forgot the attachments. These are the same exact two avatars from the same user, using my 3.23 backup, for the good avatar, then the 4.18 bad avatar Looks like a character set issue - what's the column type, BLOB or TEXT or something in between? This could be due to the server converting UTF-8 into a different character set. Characters such as 0x8F (143 decimal) and 0x8D are being converted into 0x3F, which is ? and often indicates that the character does not exist in the target collation. Basically, MySQL is treating the content as text, and replacing characters which it doesn't understand with ?. Try using a different collation or character set, and importing again? Unfortunately, the conversion is not reversible - a set of characters have been replaced with a single character, so although the image is the same binary size, some of the data has been permanently lost unless you can restore from the backup. cheers, Tom -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- Dr. Frank Ullrich, DBA Netzwerkadministration Heise Zeitschriften Verlag GmbH Co KG, Helstorfer Str. 7, D-30625 Hannover E-Mail: [EMAIL PROTECTED] Phone: +49 511 5352 587; FAX: +49 511 5352 538 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Trouble w/ mysqldump (images attached)
Sorry, forgot the attachments. These are the same exact two avatars from the same user, using my 3.23 backup, for the good avatar, then the 4.18 bad avatar attachment: brokenavatar.jpegattachment: goodavatar.jpeg-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Trouble w/ mysqldump (images attached)
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote on Thursday, January 06, 2005 4:57 PM: Sorry, forgot the attachments. These are the same exact two avatars from the same user, using my 3.23 backup, for the good avatar, then the 4.18 bad avatar Looks like a character set issue - what's the column type, BLOB or TEXT or something in between? This could be due to the server converting UTF-8 into a different character set. Characters such as 0x8F (143 decimal) and 0x8D are being converted into 0x3F, which is ? and often indicates that the character does not exist in the target collation. Basically, MySQL is treating the content as text, and replacing characters which it doesn't understand with ?. Try using a different collation or character set, and importing again? Unfortunately, the conversion is not reversible - a set of characters have been replaced with a single character, so although the image is the same binary size, some of the data has been permanently lost unless you can restore from the backup. cheers, Tom -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Trouble w/ mysqldump (images attached)
Hi Tom, Thanks for the reply! I show the following information for my DB, and shows the same for both the 3.23 DB And the 4.18a DB Field Type Collation avatardata mediumtext latin1_swedish_ci I pasted a data table from the bad avatar and the good avatar to a file differential program, there was no differential at all that the system found.. I'm not too sure where or what to do to change this information? Do you mean that I recompile MySQL using different ./configure commands? Thanks Tom! [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote on Thursday, January 06, 2005 4:57 PM: Sorry, forgot the attachments. These are the same exact two avatars from the same user, using my 3.23 backup, for the good avatar, then the 4.18 bad avatar Looks like a character set issue - what's the column type, BLOB or TEXT or something in between? This could be due to the server converting UTF-8 into a different character set. Characters such as 0x8F (143 decimal) and 0x8D are being converted into 0x3F, which is ? and often indicates that the character does not exist in the target collation. Basically, MySQL is treating the content as text, and replacing characters which it doesn't understand with ?. Try using a different collation or character set, and importing again? Unfortunately, the conversion is not reversible - a set of characters have been replaced with a single character, so although the image is the same binary size, some of the data has been permanently lost unless you can restore from the backup. cheers, Tom In a message dated 1/6/2005 12:48:28 PM Eastern Standard Time, Tom Molesworth [EMAIL PROTECTED] writes: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote on Thursday, January 06, 2005 4:57 PM: Sorry, forgot the attachments. These are the same exact two avatars from the same user, using my 3.23 backup, for the good avatar, then the 4.18 bad avatar Looks like a character set issue - what's the column type, BLOB or TEXT or something in between? This could be due to the server converting UTF-8 into a different character set. Characters such as 0x8F (143 decimal) and 0x8D are being converted into 0x3F, which is ? and often indicates that the character does not exist in the target collation. Basically, MySQL is treating the content as text, and replacing characters which it doesn't understand with ?. Try using a different collation or character set, and importing again? Unfortunately, the conversion is not reversible - a set of characters have been replaced with a single character, so although the image is the same binary size, some of the data has been permanently lost unless you can restore from the backup. cheers, Tom -- 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]
Re: How can I store Images in the MySQL Database
Have you tried my MySQL C API Site ? I have posted some C API examples here. http://www.geocities.com/jahan.geo Aftab Jahan Subear Subedar Technologies Subedar Baag Bibir Bagicha #1 North Jatrabari Dhaka 1204 Bangladesh Tel: +880-2-7519050 /* Get customized T-Shirts with logo for your IT company for 12 units @ US$14 ~ US$16. Order quantity must be atleast USD$5000++. IT company to IT company. */ Mulley, Nikhil wrote: Hi Lists , My Query is How Can I store Images in the MySQL Database , and how to Index them , can anybosy help me on this please I am starting out a Online Photo Gallery and want to share them , and I want to make the search available, Does anybody has already done on this ? Please help me in this. Regards, Nikhil. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
How can I store Images in the MySQL Database
Hi Lists , My Query is How Can I store Images in the MySQL Database , and how to Index them , can anybosy help me on this please I am starting out a Online Photo Gallery and want to share them , and I want to make the search available, Does anybody has already done on this ? Please help me in this. Regards, Nikhil.
RE: How can I store Images in the MySQL Database
Hi Nikhil, Have a look at www.hotscripts.com for either a script that dose this or a tutorial to show you how to do it. But in general you DO NOT store the image in a MySql table you just store its location name i.e. 'images/image1.png' and then with a select statement use the result in a 'img src' string for your script. Here is another place to start for a PHP example but there a loads for other scripting languages. http://www.zend.com/zend/tut/photogallery.php I hope that helps Dave Carrera -- UK Web Hosting @ http://www.ephgroup.com -Original Message- From: Mulley, Nikhil [mailto:[EMAIL PROTECTED] Sent: 02 November 2004 05:05 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: How can I store Images in the MySQL Database Hi Lists , My Query is How Can I store Images in the MySQL Database , and how to Index them , can anybosy help me on this please I am starting out a Online Photo Gallery and want to share them , and I want to make the search available, Does anybody has already done on this ? Please help me in this. Regards, Nikhil. --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.786 / Virus Database: 532 - Release Date: 29/10/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.786 / Virus Database: 532 - Release Date: 29/10/2004 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Storing Images In MySQL
I figured I'd post a follow-up to the discussion earlier this week on issues relating to storing images in MySQL. In my opinion. Whether you store images in MySQL ultimately depends on whether you can setup a caching accelerator (like Squid) between you and your visitors. Storing images in the database adds a minimum of around 28 ms of latency. Cacheing makes this a mute point since images are once again stored as files. The main benefit is that you can more easily manage a large number of images by storing them in the database. Most people, those on shared hosting services, aren't going to likely have access to a caching accelerator, so originally storing images as files is probably going to be the best approach. The most common approach that I've seen is to create some sort of directory hiearchy and divide images in groups of 1000. Two other points came up while I was playing around with this. People on dial-up accessing test pages didn't notice any difference in performance - their average ping times to the server were around 120ms. I'm guessing their connection latency helped to buffer the difference between the two approaches. Pulling images from the database usually involves a script with a parameter that indicates which image to display. For example, like this: img src='http://www.myhost.com/display_image.php?id=5' Locally installed firewalls (Zone Alarm, McAfee Internet Security, and Norton Internet Security) all blocked the display of images that were served with a script like this. Getting the images to display required renaming the script, using Apache forcetype commands, and manually parsing the URL to get the image id to display. In other words, the url ended up like this: img src='http://www.myhost.com/display_image/5' Anyone who sends me a request can get copies of the scripts and help on trying to set something up to duplicate what I did. Thanks to everyone who helped me with this - especially Dreamwerx. -Ed -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Images
From: GH [EMAIL PROTECTED] I was wondering how to get images into and out of a Mysql database was told it was possible. I have mysql 4.0.18 The general opinion is that files should be stored in a file system and not a database. There are circumstances that you might want to store binary data in a database. Take a look at the BLOB column types (http://dev.mysql.com/doc/mysql/en/BLOB.html). Regards, Jigal. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Images
It's an argument that can go on forever... We have 10's of thousands of images in mysql databases.. very fast/reliable.. easy to replicate, stream, etc.. On Tue, 28 Sep 2004 08:42:13 +0200, Jigal van Hemert [EMAIL PROTECTED] wrote: From: GH [EMAIL PROTECTED] I was wondering how to get images into and out of a Mysql database was told it was possible. I have mysql 4.0.18 The general opinion is that files should be stored in a file system and not a database. There are circumstances that you might want to store binary data in a database. Take a look at the BLOB column types (http://dev.mysql.com/doc/mysql/en/BLOB.html). Regards, Jigal. -- 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]
Re: Images
Is there anything special in your setup that you did to have such good performance? On Tue, 28 Sep 2004 11:47:26 -0400, DreamWerx [EMAIL PROTECTED] wrote: It's an argument that can go on forever... We have 10's of thousands of images in mysql databases.. very fast/reliable.. easy to replicate, stream, etc.. On Tue, 28 Sep 2004 08:42:13 +0200, Jigal van Hemert [EMAIL PROTECTED] wrote: From: GH [EMAIL PROTECTED] I was wondering how to get images into and out of a Mysql database was told it was possible. I have mysql 4.0.18 The general opinion is that files should be stored in a file system and not a database. There are circumstances that you might want to store binary data in a database. Take a look at the BLOB column types (http://dev.mysql.com/doc/mysql/en/BLOB.html). Regards, Jigal. -- 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]
Re: Images
Separate/dedicated servers for web/database. All the data was chunked to allow faster streaming/lower overhead (large images/files).. If you have more specific questions I can answer them.. On Tue, 28 Sep 2004 11:49:27 -0400, GH [EMAIL PROTECTED] wrote: Is there anything special in your setup that you did to have such good performance? On Tue, 28 Sep 2004 11:47:26 -0400, DreamWerx [EMAIL PROTECTED] wrote: It's an argument that can go on forever... We have 10's of thousands of images in mysql databases.. very fast/reliable.. easy to replicate, stream, etc.. On Tue, 28 Sep 2004 08:42:13 +0200, Jigal van Hemert [EMAIL PROTECTED] wrote: From: GH [EMAIL PROTECTED] I was wondering how to get images into and out of a Mysql database was told it was possible. I have mysql 4.0.18 The general opinion is that files should be stored in a file system and not a database. There are circumstances that you might want to store binary data in a database. Take a look at the BLOB column types (http://dev.mysql.com/doc/mysql/en/BLOB.html). Regards, Jigal. -- 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]
RE: Images
What do you mean chunked? I figured it would be easier to track about 32,000 images in MySQL than in files, so I setup a test to see what the performance difference is and if storing in MySQL would actually work. Everything is working and it's a lot easier to keep track of the images in MySQL. I ran some performance tests using Apache's ab though and there's a huge performance difference - 38 times faster grabbing the file. It could be my test system here at home. I've asked my ISP to upgrade my production server to PHP5 so that I can run tests from there. There could also be performance hits in the script that grabs the images from MySQL, because I tried using OOP. I was told OOP would be a faster approach, but I'm pretty new to it and may not have done something correctly. I'm going to create some non-OOP scripts to cross-reference the tests. I only have one production server, so I won't be able to separate / dedicate servers. Your mention of chunking sounds promising though. Actually, I'd appreciate any ideas or recommendations you have. Thanks, Ed -Original Message- From: DreamWerx [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 28, 2004 8:54 AM To: GH Cc: Jigal van Hemert; [EMAIL PROTECTED] Subject: Re: Images Separate/dedicated servers for web/database. All the data was chunked to allow faster streaming/lower overhead (large images/files).. If you have more specific questions I can answer them.. On Tue, 28 Sep 2004 11:49:27 -0400, GH [EMAIL PROTECTED] wrote: Is there anything special in your setup that you did to have such good performance? On Tue, 28 Sep 2004 11:47:26 -0400, DreamWerx [EMAIL PROTECTED] wrote: It's an argument that can go on forever... We have 10's of thousands of images in mysql databases.. very fast/reliable.. easy to replicate, stream, etc.. On Tue, 28 Sep 2004 08:42:13 +0200, Jigal van Hemert [EMAIL PROTECTED] wrote: From: GH [EMAIL PROTECTED] I was wondering how to get images into and out of a Mysql database was told it was possible. I have mysql 4.0.18 The general opinion is that files should be stored in a file system and not a database. There are circumstances that you might want to store binary data in a database. Take a look at the BLOB column types (http://dev.mysql.com/doc/mysql/en/BLOB.html). Regards, Jigal. -- 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] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Images
I have heard also that it helps to keep the table with the blobs having a low number of fields. Like just a primary key and the blob field. Have all your other metadata in a seperate table. Especially if you are going to be occasionally doing queries of just the metadata and don't want to always retrieve the image. Comments? I am doing some blob storage in Oracle with Cold Fusion. Using some purcha$ed java code to get the image in and out. Anyone else doing coldfusion with mysql blobs? How do you retrieve/display the images? --ja On Tue, 28 Sep 2004, Ed Lazor wrote: What do you mean chunked? I figured it would be easier to track about 32,000 images in MySQL than in files, so I setup a test to see what the performance difference is and if storing in MySQL would actually work. Everything is working and it's a lot easier to keep track of the images in MySQL. I ran some performance tests using Apache's ab though and there's a huge performance difference - 38 times faster grabbing the file. It could be my test system here at home. I've asked my ISP to upgrade my production server to PHP5 so that I can run tests from there. There could also be performance hits in the script that grabs the images from MySQL, because I tried using OOP. I was told OOP would be a faster approach, but I'm pretty new to it and may not have done something correctly. I'm going to create some non-OOP scripts to cross-reference the tests. I only have one production server, so I won't be able to separate / dedicate servers. Your mention of chunking sounds promising though. Actually, I'd appreciate any ideas or recommendations you have. Thanks, Ed -Original Message- From: DreamWerx [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 28, 2004 8:54 AM To: GH Cc: Jigal van Hemert; [EMAIL PROTECTED] Subject: Re: Images Separate/dedicated servers for web/database. All the data was chunked to allow faster streaming/lower overhead (large images/files).. If you have more specific questions I can answer them.. On Tue, 28 Sep 2004 11:49:27 -0400, GH [EMAIL PROTECTED] wrote: Is there anything special in your setup that you did to have such good performance? On Tue, 28 Sep 2004 11:47:26 -0400, DreamWerx [EMAIL PROTECTED] wrote: It's an argument that can go on forever... We have 10's of thousands of images in mysql databases.. very fast/reliable.. easy to replicate, stream, etc.. On Tue, 28 Sep 2004 08:42:13 +0200, Jigal van Hemert [EMAIL PROTECTED] wrote: From: GH [EMAIL PROTECTED] I was wondering how to get images into and out of a Mysql database was told it was possible. I have mysql 4.0.18 The general opinion is that files should be stored in a file system and not a database. There are circumstances that you might want to store binary data in a database. Take a look at the BLOB column types (http://dev.mysql.com/doc/mysql/en/BLOB.html). Regards, Jigal. -- 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] -- -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Images
Grabbing the file was 38 times faster because MySQL was not designed to be a filesystem. There are filesystems out there specifically designed to handle hundreds of thousands of small files. One of the best is ReiserFS http://www.namesys.com If you record the filename in mysql tracking becomes a non issue. -- Eric Bergen [EMAIL PROTECTED] On Tue, 28 Sep 2004 09:19:47 -0700, Ed Lazor [EMAIL PROTECTED] wrote: What do you mean chunked? I figured it would be easier to track about 32,000 images in MySQL than in files, so I setup a test to see what the performance difference is and if storing in MySQL would actually work. Everything is working and it's a lot easier to keep track of the images in MySQL. I ran some performance tests using Apache's ab though and there's a huge performance difference - 38 times faster grabbing the file. It could be my test system here at home. I've asked my ISP to upgrade my production server to PHP5 so that I can run tests from there. There could also be performance hits in the script that grabs the images from MySQL, because I tried using OOP. I was told OOP would be a faster approach, but I'm pretty new to it and may not have done something correctly. I'm going to create some non-OOP scripts to cross-reference the tests. I only have one production server, so I won't be able to separate / dedicate servers. Your mention of chunking sounds promising though. Actually, I'd appreciate any ideas or recommendations you have. Thanks, Ed -Original Message- From: DreamWerx [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 28, 2004 8:54 AM To: GH Cc: Jigal van Hemert; [EMAIL PROTECTED] Subject: Re: Images Separate/dedicated servers for web/database. All the data was chunked to allow faster streaming/lower overhead (large images/files).. If you have more specific questions I can answer them.. On Tue, 28 Sep 2004 11:49:27 -0400, GH [EMAIL PROTECTED] wrote: Is there anything special in your setup that you did to have such good performance? On Tue, 28 Sep 2004 11:47:26 -0400, DreamWerx [EMAIL PROTECTED] wrote: It's an argument that can go on forever... We have 10's of thousands of images in mysql databases.. very fast/reliable.. easy to replicate, stream, etc.. On Tue, 28 Sep 2004 08:42:13 +0200, Jigal van Hemert [EMAIL PROTECTED] wrote: From: GH [EMAIL PROTECTED] I was wondering how to get images into and out of a Mysql database was told it was possible. I have mysql 4.0.18 The general opinion is that files should be stored in a file system and not a database. There are circumstances that you might want to store binary data in a database. Take a look at the BLOB column types (http://dev.mysql.com/doc/mysql/en/BLOB.html). Regards, Jigal. -- 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] -- 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]
RE: Images
-Original Message- I have heard also that it helps to keep the table with the blobs having a low number of fields. Like just a primary key and the blob field. Have all your other metadata in a seperate table. Especially if you are going to be occasionally doing queries of just the metadata and don't want to always retrieve the image. Comments? I agree. That's the approach I used. Data on products are stored in a products table, while images are stored in a table called images. The images table has the following fields: ID, ProductID, SizeID, Image. There are 4 images of different resolutions for each product. The SizeID is used to tell which resolution is being requested. For example: Select Image from images where ProductID='8443' AND SizeID='1' ProductID is an int. SizeID is a small int. The Image field is largeblob, because some images are as large as 300k. However, images are generally 15k, 45k, 90k, and 180k, so perhaps largeblob is causing a performance loss? I also plan on using caching tools, so maybe performance tuning on the backend isn't as significant? What do you think? -Ed -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Images
Thanks for the link =) I understand what you're saying about MySQL not being designed as a filesystem. I've used this same argument with others. It's just that... well, have performance boosts have decreased the margin of difference? Especially when web-page caching is being used - don't the images get cached as actual files? If so, the original method of storage would be a mute point. That's what I'm trying to find out. What do you think? -Ed -Original Message- From: Eric Bergen [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 28, 2004 9:48 AM To: Ed Lazor Cc: DreamWerx; [EMAIL PROTECTED] Subject: Re: Images Grabbing the file was 38 times faster because MySQL was not designed to be a filesystem. There are filesystems out there specifically designed to handle hundreds of thousands of small files. One of the best is ReiserFS http://www.namesys.com If you record the filename in mysql tracking becomes a non issue. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Images
Most people make the mistake of using the biggest blob size to store files.. That blob size is capable of storing just HUGE files..What we do is store files in 64K (medium blob) chunks.. So if the image was say 200K in size, the metadata for the image would be 1 row in a table, and the image data would be 4 rows in the data table. 3 full 64K rows + 1 partially used rows. There is a good article/sample code here on the kind of technique we started with: http://php.dreamwerx.net/forums/viewtopic.php?t=6 Using chunked data, apache/php only needs to pull row by row(64k) and deliver to the client, keeping the resultset size low = memory overhead low. The storage servers (mysql storage) I have tested on the LAN; them storing and retreiving data from mysql (using FTP gateway) at rates of 4600K/sec.. which is I think the fastest speed my laptop network card could deliver. That's pretty fast.. Rare day when most internet users can talk to servers at those speeds. On Tue, 28 Sep 2004 09:19:47 -0700, Ed Lazor [EMAIL PROTECTED] wrote: What do you mean chunked? I figured it would be easier to track about 32,000 images in MySQL than in files, so I setup a test to see what the performance difference is and if storing in MySQL would actually work. Everything is working and it's a lot easier to keep track of the images in MySQL. I ran some performance tests using Apache's ab though and there's a huge performance difference - 38 times faster grabbing the file. It could be my test system here at home. I've asked my ISP to upgrade my production server to PHP5 so that I can run tests from there. There could also be performance hits in the script that grabs the images from MySQL, because I tried using OOP. I was told OOP would be a faster approach, but I'm pretty new to it and may not have done something correctly. I'm going to create some non-OOP scripts to cross-reference the tests. I only have one production server, so I won't be able to separate / dedicate servers. Your mention of chunking sounds promising though. Actually, I'd appreciate any ideas or recommendations you have. Thanks, Ed -Original Message- From: DreamWerx [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 28, 2004 8:54 AM To: GH Cc: Jigal van Hemert; [EMAIL PROTECTED] Subject: Re: Images Separate/dedicated servers for web/database. All the data was chunked to allow faster streaming/lower overhead (large images/files).. If you have more specific questions I can answer them.. On Tue, 28 Sep 2004 11:49:27 -0400, GH [EMAIL PROTECTED] wrote: Is there anything special in your setup that you did to have such good performance? On Tue, 28 Sep 2004 11:47:26 -0400, DreamWerx [EMAIL PROTECTED] wrote: It's an argument that can go on forever... We have 10's of thousands of images in mysql databases.. very fast/reliable.. easy to replicate, stream, etc.. On Tue, 28 Sep 2004 08:42:13 +0200, Jigal van Hemert [EMAIL PROTECTED] wrote: From: GH [EMAIL PROTECTED] I was wondering how to get images into and out of a Mysql database was told it was possible. I have mysql 4.0.18 The general opinion is that files should be stored in a file system and not a database. There are circumstances that you might want to store binary data in a database. Take a look at the BLOB column types (http://dev.mysql.com/doc/mysql/en/BLOB.html). Regards, Jigal. -- 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] -- 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]
Re: Images
It would be quite easy to drop a squid or similar proxy infront to cache the db images in memory and deliver them for a set cache-time or something.. That would be 1 way to boost performance.. On Tue, 28 Sep 2004 09:55:54 -0700, Ed Lazor [EMAIL PROTECTED] wrote: -Original Message- I have heard also that it helps to keep the table with the blobs having a low number of fields. Like just a primary key and the blob field. Have all your other metadata in a seperate table. Especially if you are going to be occasionally doing queries of just the metadata and don't want to always retrieve the image. Comments? I agree. That's the approach I used. Data on products are stored in a products table, while images are stored in a table called images. The images table has the following fields: ID, ProductID, SizeID, Image. There are 4 images of different resolutions for each product. The SizeID is used to tell which resolution is being requested. For example: Select Image from images where ProductID='8443' AND SizeID='1' ProductID is an int. SizeID is a small int. The Image field is largeblob, because some images are as large as 300k. However, images are generally 15k, 45k, 90k, and 180k, so perhaps largeblob is causing a performance loss? I also plan on using caching tools, so maybe performance tuning on the backend isn't as significant? What do you think? -Ed -- 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]
RE: Images
Ok... I have some more test results. After optimizing as much as I can think of, without using caching, I've gotten things down to a 13x difference. Using Apache's ab performance test, the image comes from a file at an average of 2ms and from the database (using PHP4) at an average of 28ms. I know... it just reiterates what you were already saying, but it sure is great to see actual numbers measuring the difference. Maybe the difference could be even less if I were properly optimizing MySQL. The big question still outstanding, for me at least, is whether web page caching makes the performance difference a mute point. If caching is storing everything as files, we get the best of both worlds. Plus, I think there may be a little bit of a security benefit. A directory has to be marked as writeable so that scripts can store image files. This isn't necessary when using MySQL. Do you agree with the security benefit? Does webpage caching negate the performance difference? -Ed -Original Message- Grabbing the file was 38 times faster because MySQL was not designed to be a filesystem. There are filesystems out there specifically designed to handle hundreds of thousands of small files. One of the best is ReiserFS http://www.namesys.com If you record the filename in mysql tracking becomes a non issue. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Images
Thanks for the article. I'll check it out. Throughput of 4600K/s is great. How's latency? -Ed -Original Message- So if the image was say 200K in size, the metadata for the image would be 1 row in a table, and the image data would be 4 rows in the data table. 3 full 64K rows + 1 partially used rows. There is a good article/sample code here on the kind of technique we started with: http://php.dreamwerx.net/forums/viewtopic.php?t=6 Using chunked data, apache/php only needs to pull row by row(64k) and deliver to the client, keeping the resultset size low = memory overhead low. The storage servers (mysql storage) I have tested on the LAN; them storing and retreiving data from mysql (using FTP gateway) at rates of 4600K/sec.. which is I think the fastest speed my laptop network card could deliver. That's pretty fast.. Rare day when most internet users can talk to servers at those speeds. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Images
I thank you all for this discussion... and for the great information that everyone has provideded. Next question (which is part of my original) how do I actually get the images into the Blobs... Additionally, the what are the names and capacities of the datatypes that I could use? I have been hearing Blob but are there others? On Tue, 28 Sep 2004 13:39:20 -0400, DreamWerx [EMAIL PROTECTED] wrote: It would be quite easy to drop a squid or similar proxy infront to cache the db images in memory and deliver them for a set cache-time or something.. That would be 1 way to boost performance.. On Tue, 28 Sep 2004 09:55:54 -0700, Ed Lazor [EMAIL PROTECTED] wrote: -Original Message- I have heard also that it helps to keep the table with the blobs having a low number of fields. Like just a primary key and the blob field. Have all your other metadata in a seperate table. Especially if you are going to be occasionally doing queries of just the metadata and don't want to always retrieve the image. Comments? I agree. That's the approach I used. Data on products are stored in a products table, while images are stored in a table called images. The images table has the following fields: ID, ProductID, SizeID, Image. There are 4 images of different resolutions for each product. The SizeID is used to tell which resolution is being requested. For example: Select Image from images where ProductID='8443' AND SizeID='1' ProductID is an int. SizeID is a small int. The Image field is largeblob, because some images are as large as 300k. However, images are generally 15k, 45k, 90k, and 180k, so perhaps largeblob is causing a performance loss? I also plan on using caching tools, so maybe performance tuning on the backend isn't as significant? What do you think? -Ed -- 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] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Images
Great .. I don't have any numbers.. but basically there is quite little latency using the FTP interface, data is streamed in and out of mysql on the fly, inserting and selecting blocks of rows.. The FTP server is written in java using JDBC to talk the database, so it's quite fast. On Tue, 28 Sep 2004 10:57:09 -0700, Ed Lazor [EMAIL PROTECTED] wrote: Thanks for the article. I'll check it out. Throughput of 4600K/s is great. How's latency? -Ed -Original Message- So if the image was say 200K in size, the metadata for the image would be 1 row in a table, and the image data would be 4 rows in the data table. 3 full 64K rows + 1 partially used rows. There is a good article/sample code here on the kind of technique we started with: http://php.dreamwerx.net/forums/viewtopic.php?t=6 Using chunked data, apache/php only needs to pull row by row(64k) and deliver to the client, keeping the resultset size low = memory overhead low. The storage servers (mysql storage) I have tested on the LAN; them storing and retreiving data from mysql (using FTP gateway) at rates of 4600K/sec.. which is I think the fastest speed my laptop network card could deliver. That's pretty fast.. Rare day when most internet users can talk to servers at those speeds. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Images
Getting images/files into blob is quite easy.. examples could be provided based on what lanaguge/interface way you want to use... Mysql site has a great list of data types and capacities, etc... do a search for it.. On Tue, 28 Sep 2004 13:58:16 -0400, GH [EMAIL PROTECTED] wrote: I thank you all for this discussion... and for the great information that everyone has provideded. Next question (which is part of my original) how do I actually get the images into the Blobs... Additionally, the what are the names and capacities of the datatypes that I could use? I have been hearing Blob but are there others? On Tue, 28 Sep 2004 13:39:20 -0400, DreamWerx [EMAIL PROTECTED] wrote: It would be quite easy to drop a squid or similar proxy infront to cache the db images in memory and deliver them for a set cache-time or something.. That would be 1 way to boost performance.. On Tue, 28 Sep 2004 09:55:54 -0700, Ed Lazor [EMAIL PROTECTED] wrote: -Original Message- I have heard also that it helps to keep the table with the blobs having a low number of fields. Like just a primary key and the blob field. Have all your other metadata in a seperate table. Especially if you are going to be occasionally doing queries of just the metadata and don't want to always retrieve the image. Comments? I agree. That's the approach I used. Data on products are stored in a products table, while images are stored in a table called images. The images table has the following fields: ID, ProductID, SizeID, Image. There are 4 images of different resolutions for each product. The SizeID is used to tell which resolution is being requested. For example: Select Image from images where ProductID='8443' AND SizeID='1' ProductID is an int. SizeID is a small int. The Image field is largeblob, because some images are as large as 300k. However, images are generally 15k, 45k, 90k, and 180k, so perhaps largeblob is causing a performance loss? I also plan on using caching tools, so maybe performance tuning on the backend isn't as significant? What do you think? -Ed -- 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] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Images
Ed brings up a great point... i would rather not have anyone 'searching' for images in directories and such... On Tue, 28 Sep 2004 10:53:01 -0700, Ed Lazor [EMAIL PROTECTED] wrote: Ok... I have some more test results. After optimizing as much as I can think of, without using caching, I've gotten things down to a 13x difference. Using Apache's ab performance test, the image comes from a file at an average of 2ms and from the database (using PHP4) at an average of 28ms. I know... it just reiterates what you were already saying, but it sure is great to see actual numbers measuring the difference. Maybe the difference could be even less if I were properly optimizing MySQL. The big question still outstanding, for me at least, is whether web page caching makes the performance difference a mute point. If caching is storing everything as files, we get the best of both worlds. Plus, I think there may be a little bit of a security benefit. A directory has to be marked as writeable so that scripts can store image files. This isn't necessary when using MySQL. Do you agree with the security benefit? Does webpage caching negate the performance difference? -Ed -Original Message- Grabbing the file was 38 times faster because MySQL was not designed to be a filesystem. There are filesystems out there specifically designed to handle hundreds of thousands of small files. One of the best is ReiserFS http://www.namesys.com If you record the filename in mysql tracking becomes a non issue. -- 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]
RE: Images
I read through the article and ran some more tests. The new scripts and tables provide similar initial latency, but I think the test results show them to be faster overall. When it comes to latency, direct file access is still the champion without caching. I think you made a good point about throughput which makes MySQL more appealing for storing larger files. That kind of surprised me actually, because I always figured I'd have to store things like PDF's on disk and control access to them by putting them outside of the document root. There's still a question of whether caching provides the edge and at what cost. I haven't set up caching, so I'm not sure if it's complicated or not. It would provide performance boosts to more than just images through, so it seems worthwhile to explore. That's what I'll be exploring next. =) -Ed -Original Message- Most people make the mistake of using the biggest blob size to store files.. That blob size is capable of storing just HUGE files..What we do is store files in 64K (medium blob) chunks.. So if the image was say 200K in size, the metadata for the image would be 1 row in a table, and the image data would be 4 rows in the data table. 3 full 64K rows + 1 partially used rows. There is a good article/sample code here on the kind of technique we started with: http://php.dreamwerx.net/forums/viewtopic.php?t=6 Using chunked data, apache/php only needs to pull row by row(64k) and deliver to the client, keeping the resultset size low = memory overhead low. The storage servers (mysql storage) I have tested on the LAN; them storing and retreiving data from mysql (using FTP gateway) at rates of 4600K/sec.. which is I think the fastest speed my laptop network card could deliver. That's pretty fast.. Rare day when most internet users can talk to servers at those speeds. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Images
I was wondering how to get images into and out of a Mysql database was told it was possible. I have mysql 4.0.18 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Images
It is possible but not very logical. MySQL isn't a filesystem. Unless you have an extreme situation you should store the path in MySQL and the image itself in a file. -- Eric Bergen [EMAIL PROTECTED] On Mon, 27 Sep 2004 18:20:02 -0400, GH [EMAIL PROTECTED] wrote: I was wondering how to get images into and out of a Mysql database was told it was possible. I have mysql 4.0.18 -- 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 from MySQL backend used with MS-Access 2000 frontend
Hi everyone, I am new to MySQL. I am starting a database project for a medium-sized medical office. I chose MS-Access (on 10-terminal pre-existing Win2K intranet) for rapid front-end dev and familiarity to the existing users. I plan to use MySQL on Linux server for backend for its speed, great support and ease of use. The database will consist of doctor's reports, schematic drawings and photos (500K JPGs and 50K PICTs). I am planning to implement that with BLOB or, alternatively, with file system while storing links to files. Later we may add webaccess through MySQL webserving or by using Access webserving options. Has anybody done anything similar? What is the best way to implement image storage (and, in future, movies, maybe)? Thanks a lot. yuri. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: images from MySQL backend used with MS-Access 2000 frontend
I would recommend storing the images on the filesystem and put the information about those images (along with the path to the image) in MySQL. If you plan to have lots of images, implement a nice logical directory structure to keep them in as in my experience linux ext2/3 is fast reading/writing files in that scenario and can be slow in retrieving files in a single directory containing large amounts of files. Cheers, Andrew -Original Message- From: Yuri Oleynikov [mailto:[EMAIL PROTECTED] Sent: Sunday 01 February 2004 16:33 To: [EMAIL PROTECTED] Subject: images from MySQL backend used with MS-Access 2000 frontend Hi everyone, I am new to MySQL. I am starting a database project for a medium-sized medical office. I chose MS-Access (on 10-terminal pre-existing Win2K intranet) for rapid front-end dev and familiarity to the existing users. I plan to use MySQL on Linux server for backend for its speed, great support and ease of use. The database will consist of doctor's reports, schematic drawings and photos (500K JPGs and 50K PICTs). I am planning to implement that with BLOB or, alternatively, with file system while storing links to files. Later we may add webaccess through MySQL webserving or by using Access webserving options. Has anybody done anything similar? What is the best way to implement image storage (and, in future, movies, maybe)? Thanks a lot. yuri. -- 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]
Re: images from MySQL backend used with MS-Access 2000 frontend
Read this article for it's design on database storage.. I have several big implementations on this design which are fast, reliable and scalable (one of them in the medical field aswell) http://php.dreamwerx.net/forums/viewtopic.php?t=6 On Sun, 1 Feb 2004, Yuri Oleynikov wrote: Hi everyone, I am new to MySQL. I am starting a database project for a medium-sized medical office. I chose MS-Access (on 10-terminal pre-existing Win2K intranet) for rapid front-end dev and familiarity to the existing users. I plan to use MySQL on Linux server for backend for its speed, great support and ease of use. The database will consist of doctor's reports, schematic drawings and photos (500K JPGs and 50K PICTs). I am planning to implement that with BLOB or, alternatively, with file system while storing links to files. Later we may add webaccess through MySQL webserving or by using Access webserving options. Has anybody done anything similar? What is the best way to implement image storage (and, in future, movies, maybe)? Thanks a lot. yuri. -- 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]
Extracting images from blob fields.
I have a small single user database into which I wish to insert and extract images. From the manual this seems to work to insert the image insert into images values(LOAD_FILE(/home/richard/scan.tiff)); but how do I get it back again? I thought this might work but it doesn't select * into outfile /home/richard/image.tiff from images; Note this is an experimental database having at present only one table with one field in the table and one record in the database. The file image.tiff seems to be full of escape characters when viewed with a binary editor. I can find nothing in the manual about how to retrieve the image and searching on the web only gives suggestions using perl, php etc to serve it to a web page but I don't have perl, php, apache etc I just want to extract the image and look at it with image magic or similar. Any advice will be greatly appreciated. -- Regards Richard -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Extracting images from blob fields.
You need to select into dumpfile instead of outfile. See the section of the manual on select syntax: http://www.mysql.com/doc/en/SELECT.html -- 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
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]
Re: BLOB images in Crystal Reports
I want to ask you one thing: Is your Crystal Report accessing the database through the Mascon Utility or it uses MyODBC? I think the main problem to me is how Crystal Report is accessing the database. I will try to access the database using ADO and see if there is any change. Thanks Emery - Original Message - From: Danny Haworth [EMAIL PROTECTED] To: Director General: NEFACOMP [EMAIL PROTECTED] Sent: Thursday, October 09, 2003 14:41 Subject: Re: BLOB images in Crystal Reports I've had no problems with MySQL, crystal reports and blob images. Main differences here are the following: Crystal Reports 8.5 (not 7) Myodbc 2.x (haven't tried 3.x yet with images) Images were also inserted into the MySQL database using a third party utility called Mascon (http://www.scibit.com/). They do a free, unlimited, version (annoying nag screens but still) if you want to try that out? If that works, you can see the differences between the way mascon stores them, and the way you are storing them.. I'm assuming if crystal is reading happily from mssql then that cant be at fault. hth danny On Thu, 2003-10-09 at 13:08, Director General: NEFACOMP wrote: It was a good idea but it is not feasible for my case since I will be displaying many images coming in a recordset with many records. If it was only one record, then I would follow your advice. When I get the images from a MS SQL 2000, Crystal Reports displays them without problems. But when I switch to MySQL, I fail. Thanks Emery - Original Message - From: DenBaguse MasRodjie [EMAIL PROTECTED] To: [EMAIL PROTECTED]; Director General: NEFACOMP [EMAIL PROTECTED] Sent: Thursday, October 09, 2003 12:44 Subject: Re: BLOB images in Crystal Reports You can manually get that BLOB binaries from MySQL and copied to local file. And from CR get that file. Rgds, Roji - Original Message - From: Director General: NEFACOMP [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: Mike Hillyer [EMAIL PROTECTED] Sent: Thursday, October 09, 2003 4:23 PM Subject: BLOB images in Crystal Reports Hi group, has anyone tried to display BLOB pictures from MySQL through MyODBC in Crystal Reports? I have tried everything but I failed. Any ideas on how to achieve this is highly appreciated. I am using: MySQL 4.1.0 or MySQL 4.0.14 MyODBC 3.51.06 Crystal Reports Ver 7 (7.0.1.192) Thanks, __ NZEYIMANA Emery Fabrice NEFA Computing Services, Inc. P.O. Box 5078 Kigali Office Phone: +250-51 11 06 Office Fax: +250-50 15 19 Mobile: +250-08517768 Email: [EMAIL PROTECTED] http://www.nefacomp.net/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: BLOB images in Crystal Reports
Crystal was pulling the data through MyODBC, Mascon was just used for inserting the image into the database. hth danny On Thu, 2003-10-09 at 16:20, Director General: NEFACOMP wrote: I want to ask you one thing: Is your Crystal Report accessing the database through the Mascon Utility or it uses MyODBC? I think the main problem to me is how Crystal Report is accessing the database. I will try to access the database using ADO and see if there is any change. Thanks Emery - Original Message - From: Danny Haworth [EMAIL PROTECTED] To: Director General: NEFACOMP [EMAIL PROTECTED] Sent: Thursday, October 09, 2003 14:41 Subject: Re: BLOB images in Crystal Reports I've had no problems with MySQL, crystal reports and blob images. Main differences here are the following: Crystal Reports 8.5 (not 7) Myodbc 2.x (haven't tried 3.x yet with images) Images were also inserted into the MySQL database using a third party utility called Mascon (http://www.scibit.com/). They do a free, unlimited, version (annoying nag screens but still) if you want to try that out? If that works, you can see the differences between the way mascon stores them, and the way you are storing them.. I'm assuming if crystal is reading happily from mssql then that cant be at fault. hth danny On Thu, 2003-10-09 at 13:08, Director General: NEFACOMP wrote: It was a good idea but it is not feasible for my case since I will be displaying many images coming in a recordset with many records. If it was only one record, then I would follow your advice. When I get the images from a MS SQL 2000, Crystal Reports displays them without problems. But when I switch to MySQL, I fail. Thanks Emery - Original Message - From: DenBaguse MasRodjie [EMAIL PROTECTED] To: [EMAIL PROTECTED]; Director General: NEFACOMP [EMAIL PROTECTED] Sent: Thursday, October 09, 2003 12:44 Subject: Re: BLOB images in Crystal Reports You can manually get that BLOB binaries from MySQL and copied to local file. And from CR get that file. Rgds, Roji - Original Message - From: Director General: NEFACOMP [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: Mike Hillyer [EMAIL PROTECTED] Sent: Thursday, October 09, 2003 4:23 PM Subject: BLOB images in Crystal Reports Hi group, has anyone tried to display BLOB pictures from MySQL through MyODBC in Crystal Reports? I have tried everything but I failed. Any ideas on how to achieve this is highly appreciated. I am using: MySQL 4.1.0 or MySQL 4.0.14 MyODBC 3.51.06 Crystal Reports Ver 7 (7.0.1.192) Thanks, __ NZEYIMANA Emery Fabrice NEFA Computing Services, Inc. P.O. Box 5078 Kigali Office Phone: +250-51 11 06 Office Fax: +250-50 15 19 Mobile: +250-08517768 Email: [EMAIL PROTECTED] http://www.nefacomp.net/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: images on database
The most common problem in such cases is that the webserver doesn't know what MIME Type the file is and so it doesn't know how to send it. If you are using PHP to upload and later show that image on the web, i could give you the code for the scripts and the structure of the table containg the binary data. Luiz Rafael Culik Guimaraes said: Dear Friends I has images saved on an mysql table as an blob field, but i could not recreate the image as file by selecting an specific record of this field any ideia Regards Luiz -- If you don't like the news, go out and make some on your own. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: images on database
Hi The most common problem in such cases is that the webserver doesn't know what MIME Type the file is and so it doesn't know how to send it. If you are using PHP to upload and later show that image on the web, i could give you the code for the scripts and the structure of the table containg the binary data. yes, i´m using php 4.1 Regards Luiz -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: images on database
Checkout: http://php.dreamwerx.net/forums/viewtopic.php?t=6 It's got streaming code.. What I do is if the type is unknown I always send application/octet-stream and the browser usually identifies it.. Or check the file extension for the file in the database, and apply content type based on that.. On Sun, 17 Aug 2003, [iso-8859-1] ÃåùñãéÜäçò Ãéþñãïò wrote: The most common problem in such cases is that the webserver doesn't know what MIME Type the file is and so it doesn't know how to send it. If you are using PHP to upload and later show that image on the web, i could give you the code for the scripts and the structure of the table containg the binary data. Luiz Rafael Culik Guimaraes said: Dear Friends I has images saved on an mysql table as an blob field, but i could not recreate the image as file by selecting an specific record of this field any ideia Regards Luiz -- If you don't like the news, go out and make some on your own. -- 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 on database
Dear Friends I has images saved on an mysql table as an blob field, but i could not recreate the image as file by selecting an specific record of this field any ideia Regards Luiz -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Saving BMP images as BLOB
Hi I am trying to save bitmap images in a InnoDB table in a field that is declared a lonblob. I am using the ODBC API of Microsoft Visual Studio 6 and saving it to MySQL via the MyODBC Driver version 3.51. The MySQL version is 4.0.12-nt. Seems like I can only save four bytes and retrieve bytes instead of the whole BMP. Here is the code for writing the image to a buffer - (char* image) CFile file; file.Open(filename.c_str(), CFile::modeRead | File::typeBinary); CFileStatus status; file.GetStatus(status); image = new char[status.m_size]; for (int i = 0; i status.m_size; ++i) image[i] = '0'; file.Read(image, status.m_size); I then make a query containing the buffer and then use SQLPrepare and SQLExecute functions to save the data to the database. Can anybody help? Franz Klein -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: How can I display images from a mySQL Database in a web page?
What I have found that works, in PHP, is using a form that allows the user to browse for a file or an image. Upon submitting the form the file is uploaded to a set location on the web server and the name of the file is added to the database. When displaying the information associated with the image, write the php page so it has the image tag and all you do is query the database for the name of the file. Let php do the rest. I realize this isn't a php list but this is what I have done in the past. You can check the www.php.net newsgroups archives for steps on accomplishing this task. Good luck, Jef -Original Message- From: Dan Anderson [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 4:31 PM To: Partap Davis Cc: [EMAIL PROTECTED] Subject: Re: How can I display images from a mySQL Database in a web page? I think there is a way to insert binary image data in your html, but is there any particular reason you need to do that? Yes, my client's server is running with particularly restrictive PHP safe mode settings and has informed me that dynamic images are a /must have/. :: bangs head against wall. starts to bleed :: So, it is relatively easy to store images into a BLOB, and slightly tricky to chop them up into the packet size and reassemble them. But trying to figure out how to do this has boggled my mind and I appreciate all the help of the community. :) -Dan -- 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]
Re: How can I display images from a mySQL Database in a web page?
Dan Anderson wrote: I have created a BLOB field to store images. Is there any way to embed them within HTML with something like: I've done some notes on this at http://www.scit.wlv.ac.uk/~jphb/sst/php/extra/images1.html - assuming of course you're using PHP as a WWW backend to dig the stuff out of the database. image start: jpeg /image Thanks in advance, Dan -- From Peter Burden, [EMAIL PROTECTED] http://www.scit.wlv.ac.uk/~jphb -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: How can I display images from a mySQL Database in a web page?
image start: jpeg /image use this: echo 'img src='.mysql_result($conn, 0, 0).' alt='; where 0,0 is the result-set index for your mysql field. you might use other mysql functions of course, but the place to put the output in is the same the html-source code will look like it is only a normal image path, but the server sends the binary data too hope that helps Maik -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
How can I display images from a mySQL Database in a web page?
I have created a BLOB field to store images. Is there any way to embed them within HTML with something like: image start: jpeg /image Thanks in advance, Dan -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]