PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi guys,
I am trying to first upload images to a directory in my server then display them dynamically using php. I really would like to make it database driven but if i try the blob stuff i get funny characters displayed on my screen. Would somebody assist me with a working code. Thanks
umm... how owould you like the display? i have 3 pages that together are a gallery script. you place this in a directory and all sub directories are automatically turned into galleries
putting images in a directory is considered the more professional approach (images as blobs in a database are an unneccessary resource drain as detailed here)
i don't know if it is very helpful to tell the people that what they are doing isn't very professional. There is ALWAYS a better and more professional solution.
If somebody wants (or must) do things in a certain way, we should help instead of only telling him or her we know it better.
Sure, but if there's a better way to do it, they should know. This example is a mistake that a lot of people seem to make (thinking that you need to store the actual image files themselves within a database). Maybe jamolo DOES need to do it this way, for some reason, but I doubt it.
I didn't find anything about pootergeist's post at all condescending or offensive. There's a better way to do things, and a good reason to do so. Why not tell him, save him some trouble?
I didn't mean to be condescending and apologize if I came across that way.
I wrote the post and linked to that thread (in which I have a much harsher post btw) to try to educate and possibly prevent jamolo from making a structure mistake that he/she later regrets.
The thread and linked pages from that should hopefully point out most of the pitfalls that can be encountered in using image blobs in databases. If he/she still desires to use that method, at least he/she will understand what obstacles may lie along that path.
I did something like this in my project for custom logos.
I had an upload form placing the images in a directroy and then also entering the filename into a database (also had username and groupname as it was for multiple users/groups).
Have a display section underneath the form showing what has been uploaded.
Can't paste the code here as it's a fair size
but i would agree with some of the others, just upload the actual file and place the filename in the database.