bolivartech Posted May 12, 2010 Share Posted May 12, 2010 I am working on a database assignment for a class and I've run into a snag that I just can't seem to figure out. When I try to display images saved in my database they come out garbled, some more viewable than others. The site is http://198.209.19.97/~lkemp/photodb/index.php There is a second issue, it seems I cannot upload more than 5 images into the database. I don't know if that is a table issue or my php code. I am using mysql Ver 14.12 Distrib 5.0.38, for pc-linux-gnu (x86_64) using readline 5.2 5.0.38-Ubuntu_0ubuntu1.4-log Ubuntu 7.04 distribution Here are some table descriptions and sample queries and I've attached the source files. I will not claim that they are all original, quite a bit are compilations from bits found online. This is my first endeavor into php so I looked for samples to get me started. mysql> desc Photo; +------------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------------+-------------+------+-----+---------+----------------+ | PhotoID | int(11) | NO | PRI | NULL | auto_increment | | PhotoData | longblob | NO | | | | | PhotoPopularity | int(11) | NO | | 0 | | | PhotoSize | int(11) | NO | | | | | PhotoDate | date | NO | | | | | PhotoDescription | varchar(45) | YES | | NULL | | | PhotoName | varchar(45) | NO | | | | | CommentStatus | tinyint(1) | NO | | 1 | | | ViewableStatus | tinyint(1) | NO | | 1 | | | UserName | varchar(48) | NO | MUL | | | | CategoryName | varchar(45) | YES | | NULL | | | PhotoType | varchar(45) | YES | | NULL | | +------------------+-------------+------+-----+---------+----------------+ 12 rows in set (0.00 sec) mysql> Select PhotoID, PhotoName, UserName, PhotoType From Photo; +---------+-----------------------+----------+------------+ | PhotoID | PhotoName | UserName | PhotoType | +---------+-----------------------+----------+------------+ | 1 | windows-logo.jpg | adavis | image/jpeg | | 2 | Truman.jpg | lkemp | image/jpeg | | 3 | Ship.jpg | lkemp | image/jpeg | | 4 | app_full_proxy[3].jpg | lkemp | image/jpeg | | 5 | Truman.jpg | lkemp | image/jpeg | +---------+-----------------------+----------+------------+ 5 rows in set (0.00 sec) mysql> Select * From Users; +----------+----------------------------------+ | UserName | Password | +----------+----------------------------------+ | adavis | 81dc9bdb52d04dc20036dbd8313ed055 | | blu | 81dc9bdb52d04dc20036dbd8313ed055 | | dkemp | 12689b7929e72f7cae8bca4d28d6f46a | | lkemp | f78f2477e949bee2d12a2c540fb6084f | | user | 81dc9bdb52d04dc20036dbd8313ed055 | +----------+----------------------------------+ 5 rows in set (0.00 sec) mysql> Select * From Users; +----------+----------------------------------+ | UserName | Password | +----------+----------------------------------+ | adavis | 81dc9bdb52d04dc20036dbd8313ed055 | | blu | 81dc9bdb52d04dc20036dbd8313ed055 | | dkemp | 12689b7929e72f7cae8bca4d28d6f46a | | lkemp | f78f2477e949bee2d12a2c540fb6084f | | user | 81dc9bdb52d04dc20036dbd8313ed055 | | user2 | 81dc9bdb52d04dc20036dbd8313ed055 | +----------+----------------------------------+ 6 rows in set (0.00 sec) [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/201462-issues-viewing-images-stored-in-database/ Share on other sites More sharing options...
CodeMaster Posted May 15, 2010 Share Posted May 15, 2010 I think uploading images in your database is a really bad idea. Every time a query is executed and requests an image, your database load is huge. It will effect the performance of your database very badly. Databases are also limited in size, there might be the problem. I think you can better save the images on your webhosting and then put the filename in the database. Quote Link to comment https://forums.phpfreaks.com/topic/201462-issues-viewing-images-stored-in-database/#findComment-1058820 Share on other sites More sharing options...
bolivartech Posted May 16, 2010 Author Share Posted May 16, 2010 I appreciate the insight, and even though I agree, this is the assignment so I cannot change it. Quote Link to comment https://forums.phpfreaks.com/topic/201462-issues-viewing-images-stored-in-database/#findComment-1059037 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.