MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old January 12th, 2003, 07:15 AM
McTrex McTrex is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: The Netherlands
Posts: 7 McTrex User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Displaying images from MySQL

Hello everybody.

I read the article about blobbing images with PHP and MySQL:
http://www.devarticles.com/art/1/68/2

What the author does to display an image is to create a new page, and send a header to indicate to the browser that it has to display an image. This technique, as far as I know, doesn't work if you want to display the image somewhere in a html-page.

I know it can be done by first writing the contents of the image into a temporary file, and then displaying that file with <img src...>

What I would like to know if the latter can also be done without creating the temporary file, straight from the database to the browser.

Anybody??

Thanx in advance,

Marco Teeuwen
http://www.mct-it.nl

Reply With Quote
  #2  
Old January 12th, 2003, 09:57 AM
pcole8787 pcole8787 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 3 pcole8787 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Lightbulb skip the blob

don't bother with blob ... it slows down the db and makes working with any kind of php/mysql manager like phpMyAdmin less effective.
Instead locate you images somewhere on the server in any number of directories depending on how you want to organzie them.
Then design you db and write your scripts to reference those locations, rather than the images themselves

Take a look at
URL
to see how it works for me.
There's excellent js in the source code for complete prevention of any right click functionality to save your images and while nothing is perfect, it makes it a bit harder to violate your copyright.

Good luck
peter

Reply With Quote
  #3  
Old January 12th, 2003, 11:03 AM
McTrex McTrex is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: The Netherlands
Posts: 7 McTrex User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanx for the advice.

Btw, that is the first right-click prevention script I see, that really works! I've had several of those, but each one of them could be circumvented with the right combination of clicks.

Thanx
Marco

Reply With Quote
  #4  
Old January 12th, 2003, 01:23 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
Peter,

Although the disabling of the right click works in this case, there's always a workaround... If you're concerned about people "stealing" your images... Consider putting a small watermark with your name on the one of the corners... As long as it's not so big that it distracts from the image itself.
__________________
____________________________________________
Developer Shed Weekly Writer | DevArticles Forum Moderator
Build Your Own KlipFolio Klip With PHP
FrankManno.com - Under Construction
Design Interactive Group - Under Construction

Reply With Quote
  #5  
Old January 12th, 2003, 03:08 PM
Kanu Kanu is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 91 Kanu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Re: skip the blob

Quote:
Originally posted by pcole8787
don't bother with blob ... it slows down the db and makes working with any kind of php/mysql manager like phpMyAdmin less effective.
vBulletin seems to manage fine

Reply With Quote
  #6  
Old January 12th, 2003, 05:41 PM
pcole8787 pcole8787 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 3 pcole8787 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
the point is this

you're probably right ... the reason i mention this is the first place is this. Try doing a table dump when you have 500-1000 images in a db with the image contained in a blob .... that's alot of data on your screen.

Plus, by referencing the location of the image with your database record, you don't have to create a file with an image header just to render the image. You simply call the record that points to your image, and bingo there it is.

Either way is probably fine, but having done both, i find it much easier to maintain and evolve a gallery without using the blob field.

cheers,
peter

Reply With Quote
  #7  
Old January 12th, 2003, 08:37 PM
kylie kylie is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 19 kylie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
if you want to call a blob image into your html page, then you will need to call the image in the following manner.

<img src="download.php?blobId=1">

This would call the php file which would display the image based on the blob id.

Reply With Quote
  #8  
Old January 13th, 2003, 04:17 AM
McTrex McTrex is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: The Netherlands
Posts: 7 McTrex User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Kylie,

thanx, that'll be the way I didn't know about. I'll check it out.

PCole,

I'm not sure which way to go yet, it's the first time I used images in combination with a database. I'll try both methods.

Thanx for the advice!

McTrex

Reply With Quote
  #9  
Old January 13th, 2003, 07:33 AM
hermawan hermawan is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: DKI Jakarta
Posts: 2 hermawan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to hermawan
I also ever create a tutorial for that scheme.
Follow this tutorial to find it out.

Reply With Quote
  #10  
Old January 14th, 2003, 08:52 AM
yoda yoda is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 1 yoda User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
imagecopyresample to img html tag

Hi! figure this:
You want to create a web photo album, you decide to store your images in your server but all the references about the picture are in a mysql database so, you store additional information about the picture in the database with the name of the image, then in the display script you set de directory name as the name were the images are stored and join it with the name of the image to display. OK? But, you want to make the thumbnails of the pictures on the fly using imagecopyresample function. How can I display this dynamicly generated thumbnail in a img tag? I can do the whole thing for one image sending a header but I just don't know how it can be done sending the image to a img tag.
I hope some of you can help me.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > Displaying images from MySQL


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway