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: 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]
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]
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
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
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" 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]
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: Images to MySql Database in PHP or JAVA
Hi, Have you try google ? http://www.google.fr/search?hl=fr&q=storing+image+in+mysql&btnG=Recherche+Google&meta= 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]
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: Images
Tons of caching options.. tried quite a few.. - squid/similar proxy.. - the image streaming/serving script stores the image in /tmp, if the script next time sees the time file (perhaps using databaseid.img filename format) it serves it from disk.. maybe checking the last changed timestamp or something - written a custom caching servlet to request the image from db once, and then serve it from memory for a pre-determined cache time, at which point it re-request/re-caches new object in memory.. On Tue, 28 Sep 2004 11:50:37 -0700, Ed Lazor <[EMAIL PROTECTED]> wrote: > 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]
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]
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
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
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
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
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
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
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
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
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
> -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
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
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
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
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
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
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
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 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]
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]
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 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]
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
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
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
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: 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]
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
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 with mysql
Not an issue since you don't need to edit the htaccess file for every file. You set it for the whole directory. The only reason for preventing ppl to access files would be theft of bandwith. If you worry about ppl being able to get the images then you shouldn't publish them at all. You can't protect them from being dumped with printscreen. Another solution would be to change the the path at random and copy all images to the new location while you copy a special image on the old location. You have no idea how fast ppl will stop using your pics if they have the text "stolen from ..." where you put your domainname on the dots. This would require you to have the path to the file in your code. HTTP REFERER is not always set correctly so I wouldn't trust that to much. B. At 09:13 21-03-2003 +0100, lasse wrote: sure you can. And i don't mind you disagreeing with me either =) Although, if the solution/site is meant to be used by other than people who know something about the webserver i don't think it's a good solution. I can imagine writing something that reads the htaccess-file and edits it... but i don't like the possible securtyissues with that. Besides... if you render a page with a selectbox from mysqltables and another with images and let the user match them together, it's idiotproof =) If you have a php(or whatever)-file wich sole purpouse is to check users rights and render images it can also always check if you have the right cookies. If you've been to the right previous page to see that picture, if not redirect to '/'; Do you get my point? I still believe that the blob i my saviour... (despite the obvious loss of performance) On Thu, 20 Mar 2003, B. van Ouwerkerk wrote: > You can use other ways to protect your images from linking by others. Like > with Apache and htaccess.. > > I don't agree with you on your opinion that it's easier to code. If you > insert a link into your database all you have to do is retrieve it and push > the link to the browser. > > > > B. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: images with mysql
Don't forget that the images can be stored *outside* the root dir. Access them using ../../ until you reach your img dir. There's no way to get to the images directly then. Paul -Original Message- From: lasse [mailto:[EMAIL PROTECTED] Sent: Friday, March 21, 2003 12:14 AM To: unlisted-recipients:; no To-header on input Cc: [EMAIL PROTECTED] Subject: Re: images with mysql sure you can. And i don't mind you disagreeing with me either =) Although, if the solution/site is meant to be used by other than people who know something about the webserver i don't think it's a good solution. I can imagine writing something that reads the htaccess-file and edits it... but i don't like the possible securtyissues with that. Besides... if you render a page with a selectbox from mysqltables and another with images and let the user match them together, it's idiotproof =) If you have a php(or whatever)-file wich sole purpouse is to check users rights and render images it can also always check if you have the right cookies. If you've been to the right previous page to see that picture, if not redirect to '/'; Do you get my point? I still believe that the blob i my saviour... (despite the obvious loss of performance) On Thu, 20 Mar 2003, B. van Ouwerkerk wrote: > You can use other ways to protect your images from linking by others. Like > with Apache and htaccess.. > > I don't agree with you on your opinion that it's easier to code. If you > insert a link into your database all you have to do is retrieve it and push > the link to the browser. > > > > B. > > > At 20:18 20-03-2003 +0100, lasse wrote: > >hey all.. new to the list. > > > >Just my 5 cents... > >I think it's better to store images in the database, sure you loose a bit > >in performance, but it's easier to code. > > > >The way i've done it before is always a separate render.php (or what ever) > >that compares the users rights to view that image, get's the blob from the > >database, sets right content-type for the page and then renders the > >binary data. > > > >That way... you can control frames/design (direct links to images can be > >avoided) und so weiter... > > > >//lars > > > >On Thu, 20 Mar 2003, B. van Ouwerkerk wrote: > > > > > I assume it is, have not tested it.. > > > > > > If you need to fetch the files from the database your app needs to wait > > > until it has recieved the data. If you only store name/path info it will > > > take less time to fetch the data, ship it off to the browser which can > > > start fetching the images without connecting to the database again. > > > > > > Sounds pretty logical.. and it gets worse if your site is hosted by an ISP > > > who is using a database server running on a seperate box.. > > > > > > > > > B. > > > > > > > > > At 21:35 20-03-2003 +, Lai Liu-yuan wrote: > > > >Well, this may be off topic. > > > > > > > >In my case, I store tens of thousands of images, gradually growing. All of > > > >them are quite small, most around 30*30 gray scale. Would it still be > > > >faster to store them on disk? > > > > > > > >On Thu, 20 Mar 2003 13:57:06 +0100 > > > >"B. van Ouwerkerk" <[EMAIL PROTECTED]> wrote: > > > > > > > > > IMHO it's better to store a link. > > > > > I have seen databases (not MySQL) getting corrupted because the file > > > > > inserted was to big. > > > > > > > > > > For the visitor it doesn't really matter whether you put it into the > > > > > database or not. A link is less difficult and you don't have to > > retrieve > > > > > pictures from the database so it might be quicker.. > > > > > > > > > > > > > > > > > > > > B. > > > > > > > > > > > > > > > At 18:34 20-03-2003 +, Lai Liu-yuan wrote: > > > > > >I am now having a database storing images of chinese characters for > > > > > >research purpose. I wrote a program to store and retrieve them. My > > images > > > > > >are of type ppm. This is how I designed my table: > > > > > > > > > > > >mysql> describe poor; > > > > > >+++--+-+-+---+ > > > > > >| Field | Type
Re: images with mysql
sure you can. And i don't mind you disagreeing with me either =) Although, if the solution/site is meant to be used by other than people who know something about the webserver i don't think it's a good solution. I can imagine writing something that reads the htaccess-file and edits it... but i don't like the possible securtyissues with that. Besides... if you render a page with a selectbox from mysqltables and another with images and let the user match them together, it's idiotproof =) If you have a php(or whatever)-file wich sole purpouse is to check users rights and render images it can also always check if you have the right cookies. If you've been to the right previous page to see that picture, if not redirect to '/'; Do you get my point? I still believe that the blob i my saviour... (despite the obvious loss of performance) On Thu, 20 Mar 2003, B. van Ouwerkerk wrote: > You can use other ways to protect your images from linking by others. Like > with Apache and htaccess.. > > I don't agree with you on your opinion that it's easier to code. If you > insert a link into your database all you have to do is retrieve it and push > the link to the browser. > > > > B. > > > At 20:18 20-03-2003 +0100, lasse wrote: > >hey all.. new to the list. > > > >Just my 5 cents... > >I think it's better to store images in the database, sure you loose a bit > >in performance, but it's easier to code. > > > >The way i've done it before is always a separate render.php (or what ever) > >that compares the users rights to view that image, get's the blob from the > >database, sets right content-type for the page and then renders the > >binary data. > > > >That way... you can control frames/design (direct links to images can be > >avoided) und so weiter... > > > >//lars > > > >On Thu, 20 Mar 2003, B. van Ouwerkerk wrote: > > > > > I assume it is, have not tested it.. > > > > > > If you need to fetch the files from the database your app needs to wait > > > until it has recieved the data. If you only store name/path info it will > > > take less time to fetch the data, ship it off to the browser which can > > > start fetching the images without connecting to the database again. > > > > > > Sounds pretty logical.. and it gets worse if your site is hosted by an ISP > > > who is using a database server running on a seperate box.. > > > > > > > > > B. > > > > > > > > > At 21:35 20-03-2003 +, Lai Liu-yuan wrote: > > > >Well, this may be off topic. > > > > > > > >In my case, I store tens of thousands of images, gradually growing. All of > > > >them are quite small, most around 30*30 gray scale. Would it still be > > > >faster to store them on disk? > > > > > > > >On Thu, 20 Mar 2003 13:57:06 +0100 > > > >"B. van Ouwerkerk" <[EMAIL PROTECTED]> wrote: > > > > > > > > > IMHO it's better to store a link. > > > > > I have seen databases (not MySQL) getting corrupted because the file > > > > > inserted was to big. > > > > > > > > > > For the visitor it doesn't really matter whether you put it into the > > > > > database or not. A link is less difficult and you don't have to > > retrieve > > > > > pictures from the database so it might be quicker.. > > > > > > > > > > > > > > > > > > > > B. > > > > > > > > > > > > > > > At 18:34 20-03-2003 +, Lai Liu-yuan wrote: > > > > > >I am now having a database storing images of chinese characters for > > > > > >research purpose. I wrote a program to store and retrieve them. My > > images > > > > > >are of type ppm. This is how I designed my table: > > > > > > > > > > > >mysql> describe poor; > > > > > >+++--+-+-+---+ > > > > > >| Field | Type | Null | Key | Default | Extra | > > > > > >+++--+-+-+---+ > > > > > >| cc | char(2) binary | | | | | > > > > > >| width | int(1) | YES | | NULL| | > > > > > >| height | int(1) | YES | | NULL| | > > > > > >| data | blob | YES | | NULL| | > > > > > >+++--+-+-+---+ > > > > > > > > > > > >Just have to be really careful in storing binary data. Hope this help. > > > > > > > > > > > >On Thu, 20 Mar 2003 10:34:19 +0100 > > > > > >[EMAIL PROTECTED] wrote: > > > > > > > > > > > > > Hi! > > > > > > > > > > > > > > I have a problem with my MySQL > > > > > > > > > > > > > > I need to have some a images related with an item > > > > > > > > > > > > > > for example > > > > > > > > > > > > > > -- > > > > > > > ! author ! date of birth an death ! image! > > > > > > > -- > > > > > > > > > > > > > > How can I define the field for the images? I have read that > > LONGBLOB > > > > > > > could be useful for large objct like images, but I can't > > understand how > > > > > > > to set it in my database... > > > > > > > > > > > > > > Thank you in advance > >
Re: images with mysql
You can use other ways to protect your images from linking by others. Like with Apache and htaccess.. I don't agree with you on your opinion that it's easier to code. If you insert a link into your database all you have to do is retrieve it and push the link to the browser. B. At 20:18 20-03-2003 +0100, lasse wrote: hey all.. new to the list. Just my 5 cents... I think it's better to store images in the database, sure you loose a bit in performance, but it's easier to code. The way i've done it before is always a separate render.php (or what ever) that compares the users rights to view that image, get's the blob from the database, sets right content-type for the page and then renders the binary data. That way... you can control frames/design (direct links to images can be avoided) und so weiter... //lars On Thu, 20 Mar 2003, B. van Ouwerkerk wrote: > I assume it is, have not tested it.. > > If you need to fetch the files from the database your app needs to wait > until it has recieved the data. If you only store name/path info it will > take less time to fetch the data, ship it off to the browser which can > start fetching the images without connecting to the database again. > > Sounds pretty logical.. and it gets worse if your site is hosted by an ISP > who is using a database server running on a seperate box.. > > > B. > > > At 21:35 20-03-2003 +, Lai Liu-yuan wrote: > >Well, this may be off topic. > > > >In my case, I store tens of thousands of images, gradually growing. All of > >them are quite small, most around 30*30 gray scale. Would it still be > >faster to store them on disk? > > > >On Thu, 20 Mar 2003 13:57:06 +0100 > >"B. van Ouwerkerk" <[EMAIL PROTECTED]> wrote: > > > > > IMHO it's better to store a link. > > > I have seen databases (not MySQL) getting corrupted because the file > > > inserted was to big. > > > > > > For the visitor it doesn't really matter whether you put it into the > > > database or not. A link is less difficult and you don't have to retrieve > > > pictures from the database so it might be quicker.. > > > > > > > > > > > > B. > > > > > > > > > At 18:34 20-03-2003 +, Lai Liu-yuan wrote: > > > >I am now having a database storing images of chinese characters for > > > >research purpose. I wrote a program to store and retrieve them. My images > > > >are of type ppm. This is how I designed my table: > > > > > > > >mysql> describe poor; > > > >+++--+-+-+---+ > > > >| Field | Type | Null | Key | Default | Extra | > > > >+++--+-+-+---+ > > > >| cc | char(2) binary | | | | | > > > >| width | int(1) | YES | | NULL| | > > > >| height | int(1) | YES | | NULL| | > > > >| data | blob | YES | | NULL| | > > > >+++--+-+-+---+ > > > > > > > >Just have to be really careful in storing binary data. Hope this help. > > > > > > > >On Thu, 20 Mar 2003 10:34:19 +0100 > > > >[EMAIL PROTECTED] wrote: > > > > > > > > > Hi! > > > > > > > > > > I have a problem with my MySQL > > > > > > > > > > I need to have some a images related with an item > > > > > > > > > > for example > > > > > > > > > > -- > > > > > ! author ! date of birth an death ! image! > > > > > -- > > > > > > > > > > How can I define the field for the images? I have read that LONGBLOB > > > > > could be useful for large objct like images, but I can't understand how > > > > > to set it in my database... > > > > > > > > > > Thank you in advance > > > > > > > > > > stefano > > > > > -- > > > > > S t e f a n o C a r d o > > > > > Debian GNU-Linux user > > > > > > > > > > > > > > - > > > Before posting, please check: > > >http://www.mysql.com/manual.php (the manual) > > >http://lists.mysql.com/ (the list archive) > > > > > > To request this thread, e-mail <[EMAIL PROTECTED]> > > > To unsubscribe, e-mail > > <[EMAIL PROTECTED]> > > > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > > > > > > > > >- > >Before posting, please check: > >http://www.mysql.com/manual.php (the manual) > >http://lists.mysql.com/ (the list archive) > > > >To request this thread, e-mail <[EMAIL PROTECTED]> > >To unsubscribe, e-mail <[EMAIL PROTECTED]> > >Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > > - > Before posting, please check: >http://www.mysql.com/manual.php (the manual) >http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]>
Re: images with mysql
hey all.. new to the list. Just my 5 cents... I think it's better to store images in the database, sure you loose a bit in performance, but it's easier to code. The way i've done it before is always a separate render.php (or what ever) that compares the users rights to view that image, get's the blob from the database, sets right content-type for the page and then renders the binary data. That way... you can control frames/design (direct links to images can be avoided) und so weiter... //lars On Thu, 20 Mar 2003, B. van Ouwerkerk wrote: > I assume it is, have not tested it.. > > If you need to fetch the files from the database your app needs to wait > until it has recieved the data. If you only store name/path info it will > take less time to fetch the data, ship it off to the browser which can > start fetching the images without connecting to the database again. > > Sounds pretty logical.. and it gets worse if your site is hosted by an ISP > who is using a database server running on a seperate box.. > > > B. > > > At 21:35 20-03-2003 +, Lai Liu-yuan wrote: > >Well, this may be off topic. > > > >In my case, I store tens of thousands of images, gradually growing. All of > >them are quite small, most around 30*30 gray scale. Would it still be > >faster to store them on disk? > > > >On Thu, 20 Mar 2003 13:57:06 +0100 > >"B. van Ouwerkerk" <[EMAIL PROTECTED]> wrote: > > > > > IMHO it's better to store a link. > > > I have seen databases (not MySQL) getting corrupted because the file > > > inserted was to big. > > > > > > For the visitor it doesn't really matter whether you put it into the > > > database or not. A link is less difficult and you don't have to retrieve > > > pictures from the database so it might be quicker.. > > > > > > > > > > > > B. > > > > > > > > > At 18:34 20-03-2003 +, Lai Liu-yuan wrote: > > > >I am now having a database storing images of chinese characters for > > > >research purpose. I wrote a program to store and retrieve them. My images > > > >are of type ppm. This is how I designed my table: > > > > > > > >mysql> describe poor; > > > >+++--+-+-+---+ > > > >| Field | Type | Null | Key | Default | Extra | > > > >+++--+-+-+---+ > > > >| cc | char(2) binary | | | | | > > > >| width | int(1) | YES | | NULL| | > > > >| height | int(1) | YES | | NULL| | > > > >| data | blob | YES | | NULL| | > > > >+++--+-+-+---+ > > > > > > > >Just have to be really careful in storing binary data. Hope this help. > > > > > > > >On Thu, 20 Mar 2003 10:34:19 +0100 > > > >[EMAIL PROTECTED] wrote: > > > > > > > > > Hi! > > > > > > > > > > I have a problem with my MySQL > > > > > > > > > > I need to have some a images related with an item > > > > > > > > > > for example > > > > > > > > > > -- > > > > > ! author ! date of birth an death ! image! > > > > > -- > > > > > > > > > > How can I define the field for the images? I have read that LONGBLOB > > > > > could be useful for large objct like images, but I can't understand how > > > > > to set it in my database... > > > > > > > > > > Thank you in advance > > > > > > > > > > stefano > > > > > -- > > > > > S t e f a n o C a r d o > > > > > Debian GNU-Linux user > > > > > > > > > > > > > > - > > > Before posting, please check: > > >http://www.mysql.com/manual.php (the manual) > > >http://lists.mysql.com/ (the list archive) > > > > > > To request this thread, e-mail <[EMAIL PROTECTED]> > > > To unsubscribe, e-mail > > <[EMAIL PROTECTED]> > > > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > > > > > > > > >- > >Before posting, please check: > >http://www.mysql.com/manual.php (the manual) > >http://lists.mysql.com/ (the list archive) > > > >To request this thread, e-mail <[EMAIL PROTECTED]> > >To unsubscribe, e-mail <[EMAIL PROTECTED]> > >Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > > - > Before posting, please check: >http://www.mysql.com/manual.php (the manual) >http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > -- -BEGIN GEEK CODE BLOCK- Version: 3.1 (2002 update) GCM/GCS/GMU/ d+ s++:++ a-- C++() UBLAIS+() P+ L+(-) E--- W+++ N+ o-- K w O- M- V- PS(+++) PE++ Y PGP- t 5+ X++ R- tv+ b+ DI+++ D- G e h++ r% y++ --END GEEK CODE BLOCK-- -
Re: images with mysql
I assume it is, have not tested it.. If you need to fetch the files from the database your app needs to wait until it has recieved the data. If you only store name/path info it will take less time to fetch the data, ship it off to the browser which can start fetching the images without connecting to the database again. Sounds pretty logical.. and it gets worse if your site is hosted by an ISP who is using a database server running on a seperate box.. B. At 21:35 20-03-2003 +, Lai Liu-yuan wrote: Well, this may be off topic. In my case, I store tens of thousands of images, gradually growing. All of them are quite small, most around 30*30 gray scale. Would it still be faster to store them on disk? On Thu, 20 Mar 2003 13:57:06 +0100 "B. van Ouwerkerk" <[EMAIL PROTECTED]> wrote: > IMHO it's better to store a link. > I have seen databases (not MySQL) getting corrupted because the file > inserted was to big. > > For the visitor it doesn't really matter whether you put it into the > database or not. A link is less difficult and you don't have to retrieve > pictures from the database so it might be quicker.. > > > > B. > > > At 18:34 20-03-2003 +, Lai Liu-yuan wrote: > >I am now having a database storing images of chinese characters for > >research purpose. I wrote a program to store and retrieve them. My images > >are of type ppm. This is how I designed my table: > > > >mysql> describe poor; > >+++--+-+-+---+ > >| Field | Type | Null | Key | Default | Extra | > >+++--+-+-+---+ > >| cc | char(2) binary | | | | | > >| width | int(1) | YES | | NULL| | > >| height | int(1) | YES | | NULL| | > >| data | blob | YES | | NULL| | > >+++--+-+-+---+ > > > >Just have to be really careful in storing binary data. Hope this help. > > > >On Thu, 20 Mar 2003 10:34:19 +0100 > >[EMAIL PROTECTED] wrote: > > > > > Hi! > > > > > > I have a problem with my MySQL > > > > > > I need to have some a images related with an item > > > > > > for example > > > > > > -- > > > ! author ! date of birth an death ! image! > > > -- > > > > > > How can I define the field for the images? I have read that LONGBLOB > > > could be useful for large objct like images, but I can't understand how > > > to set it in my database... > > > > > > Thank you in advance > > > > > > stefano > > > -- > > > S t e f a n o C a r d o > > > Debian GNU-Linux user > > > > > > - > Before posting, please check: >http://www.mysql.com/manual.php (the manual) >http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: images with mysql
Lai Liu-yuan wrote: > > Well, this may be off topic. > > In my case, I store tens of thousands of images, gradually growing. All of them are > quite small, most around 30*30 gray scale. Would it still be faster to store them on > disk? > In most cases yes. We have over 3.5 million images stored and mananaging them from the database side would be almost impossible. There are many benifits to using the file system instead of the database. 1. You can archive the images on cd/dvd/tape as new ones are received/added. 2. Try converting or moving databases with 200GB of blob files. 3. The larger the database, the longer it takes to retreive information. 4. Data from a database is retreived one row at a time so you have to wait for each image. Storing the path in the database allows you to fetch a row, spawn a child process to fetch the image, and continue to fetch rows from the database while the child processes handle getting the images. 5. Mysql will not cache the images. The OS however will cache disk reads. 6. The database has a finite set of resources. You can add many file servers, each specific to what "type" of image you're pulling. We store stuff by date so we know to pull 1998 images from fileserver a and 1999 images from fileserver b, etc... The OS on each fileserver can then cache what is requested most often. Good luck! walt - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: images with mysql
Well, this may be off topic. In my case, I store tens of thousands of images, gradually growing. All of them are quite small, most around 30*30 gray scale. Would it still be faster to store them on disk? On Thu, 20 Mar 2003 13:57:06 +0100 "B. van Ouwerkerk" <[EMAIL PROTECTED]> wrote: > IMHO it's better to store a link. > I have seen databases (not MySQL) getting corrupted because the file > inserted was to big. > > For the visitor it doesn't really matter whether you put it into the > database or not. A link is less difficult and you don't have to retrieve > pictures from the database so it might be quicker.. > > > > B. > > > At 18:34 20-03-2003 +, Lai Liu-yuan wrote: > >I am now having a database storing images of chinese characters for > >research purpose. I wrote a program to store and retrieve them. My images > >are of type ppm. This is how I designed my table: > > > >mysql> describe poor; > >+++--+-+-+---+ > >| Field | Type | Null | Key | Default | Extra | > >+++--+-+-+---+ > >| cc | char(2) binary | | | | | > >| width | int(1) | YES | | NULL| | > >| height | int(1) | YES | | NULL| | > >| data | blob | YES | | NULL| | > >+++--+-+-+---+ > > > >Just have to be really careful in storing binary data. Hope this help. > > > >On Thu, 20 Mar 2003 10:34:19 +0100 > >[EMAIL PROTECTED] wrote: > > > > > Hi! > > > > > > I have a problem with my MySQL > > > > > > I need to have some a images related with an item > > > > > > for example > > > > > > -- > > > ! author ! date of birth an death ! image! > > > -- > > > > > > How can I define the field for the images? I have read that LONGBLOB > > > could be useful for large objct like images, but I can't understand how > > > to set it in my database... > > > > > > Thank you in advance > > > > > > stefano > > > -- > > > S t e f a n o C a r d o > > > Debian GNU-Linux user > > > > > > - > Before posting, please check: >http://www.mysql.com/manual.php (the manual) >http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: images with mysql
IMHO it's better to store a link. I have seen databases (not MySQL) getting corrupted because the file inserted was to big. For the visitor it doesn't really matter whether you put it into the database or not. A link is less difficult and you don't have to retrieve pictures from the database so it might be quicker.. B. At 18:34 20-03-2003 +, Lai Liu-yuan wrote: I am now having a database storing images of chinese characters for research purpose. I wrote a program to store and retrieve them. My images are of type ppm. This is how I designed my table: mysql> describe poor; +++--+-+-+---+ | Field | Type | Null | Key | Default | Extra | +++--+-+-+---+ | cc | char(2) binary | | | | | | width | int(1) | YES | | NULL| | | height | int(1) | YES | | NULL| | | data | blob | YES | | NULL| | +++--+-+-+---+ Just have to be really careful in storing binary data. Hope this help. On Thu, 20 Mar 2003 10:34:19 +0100 [EMAIL PROTECTED] wrote: > Hi! > > I have a problem with my MySQL > > I need to have some a images related with an item > > for example > > -- > ! author ! date of birth an death ! image! > -- > > How can I define the field for the images? I have read that LONGBLOB > could be useful for large objct like images, but I can't understand how > to set it in my database... > > Thank you in advance > > stefano > -- > S t e f a n o C a r d o > Debian GNU-Linux user > - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: images with mysql
I am now having a database storing images of chinese characters for research purpose. I wrote a program to store and retrieve them. My images are of type ppm. This is how I designed my table: mysql> describe poor; +++--+-+-+---+ | Field | Type | Null | Key | Default | Extra | +++--+-+-+---+ | cc | char(2) binary | | | | | | width | int(1) | YES | | NULL| | | height | int(1) | YES | | NULL| | | data | blob | YES | | NULL| | +++--+-+-+---+ Just have to be really careful in storing binary data. Hope this help. On Thu, 20 Mar 2003 10:34:19 +0100 [EMAIL PROTECTED] wrote: > Hi! > > I have a problem with my MySQL > > I need to have some a images related with an item > > for example > > -- > ! author ! date of birth an death ! image! > -- > > How can I define the field for the images? I have read that LONGBLOB > could be useful for large objct like images, but I can't understand how > to set it in my database... > > Thank you in advance > > stefano > -- > S t e f a n o C a r d o > Debian GNU-Linux user > > - > Before posting, please check: >http://www.mysql.com/manual.php (the manual) >http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: images with mysql
I had a go with putting a image into MySQL and it did not work. But what I did do is put the directory and image location "/image/smile.jpg". This is very good way to use the index of the db and the speed of the file structure. Sorry if this was not what you were looking for but I hope it helps a bit. Simon -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 20 March 2003 09:34 To: [EMAIL PROTECTED] Subject: Re: images with mysql Hi! I have a problem with my MySQL I need to have some a images related with an item for example -- ! author ! date of birth an death ! image! -- How can I define the field for the images? I have read that LONGBLOB could be useful for large objct like images, but I can't understand how to set it in my database... Thank you in advance stefano -- S t e f a n o C a r d o Debian GNU-Linux user - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: images with mysql
Hi! I have a problem with my MySQL I need to have some a images related with an item for example -- ! author ! date of birth an death ! image! -- How can I define the field for the images? I have read that LONGBLOB could be useful for large objct like images, but I can't understand how to set it in my database... Thank you in advance stefano -- S t e f a n o C a r d o Debian GNU-Linux user - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Images in MySql
Eric, Generally you would store references to the images in the database as a full or partial pathname. You can store binary data in the db itself using the BLOB type but this is not necessarily the most efficient approach to take John Lodge -Original Message- From: Eric Torr Klopper [mailto:[EMAIL PROTECTED]] Sent: Monday, January 28, 2002 12:31 PM To: [EMAIL PROTECTED] Subject: Images in MySql Hi all. Eric here from South Africa. I'm fairly new at using mysql and need to access images via a php website. What is the best way to store images or reference to images like jpg and gifs in a mysql db? Also what would the sql querie look like to call the and view the image. Is there any documentation specificaly geared towards to images in mysql. Any help on the matter would be greatly appreciated. Thank you Eric Torr Klopper Thrasher Technologies +27 82 219 3994 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: images
yes but not advisable. Check the archives for more info. Cal http://www.calevans.com -Original Message- From: Neil Davies [mailto:[EMAIL PROTECTED]] Sent: Monday, September 03, 2001 10:28 AM To: [EMAIL PROTECTED] Subject: images I was wondering if it's possible to place image files within mysql tables? - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: images
> From: Neil Davies [mailto:[EMAIL PROTECTED]] > > I was wondering if it's possible to place image files within mysql > tables? http://www.bitbybit.dk/mysqlfaq/faq.html#ch7_15_0 / Carsten -- Carsten H. Pedersen keeper and maintainer of the bitbybit.dk MySQL FAQ http://www.bitbybit.dk/mysqlfaq - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: images and mysql
This topic has been discussed many times on the PHP General (archived at http://marc.theaimsgroup.com/?l=php-general) and PHP DB (archived at http://marc.theaimsgroup.com/?l=php-db) mailing lists. Search the archives for the terms 'MySQL images blob' and you will find a wealth of posts. Good Luck! --zak J.Heegsma wrote: > I use a mysql database on the web and use > php to get information from it. > Now I want to use pictures/images in the > database. I've included a php script > The information I get from the mysql database > in a while statement. My question is, how do > I get the picture available on the web, must > I put this in the mysql-database and how do I do this? [snip] - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php