| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Barru. | PHP search form Can someone make or teach me how to make a PHP search form for my image hosting site (wip) it should search for .gif, .jpg, .png and .bmp. It should also when they click on a result take the user to "/uploads/browseupload.php?file=[resultname].[resultextension]". If someone could do that it would be really great, thanks in advance. if possible a bit of php that would load the image on the "/uploads/browseupload.php?file=[resultname].[resultextension]" page. thanks again.
__________________ |
| |
| | #2 (permalink) |
| DNOA Member | I'll do it if you can add to my reputation ![]() What you might want to do is store the files in a MySQL database (they're MUCH easier to search with instead of raw file names) and then search that...
__________________ codeboards A high-quality community of programmers -- Join today and post! We want new members! |
| |
| | #4 (permalink) |
| DNOA Member | Thanks, um, ... actually I guess I wasn't clear - I don't know how to do it without MySQL ... :-/
__________________ codeboards A high-quality community of programmers -- Join today and post! We want new members! |
| |
| | #6 (permalink) |
| NamePros Member | Try this (i can up with it quickly though, so MIGHT be some errors) It should work for the most part I believe :/ PHP Code:
__________________ I wonder... Last edited by Outer; 08-08-2005 at 04:09 PM. |
| |
| | #8 (permalink) |
| NamePros Member | PHP Code: to get that, use PHP Code:
__________________ I wonder... |
| |
| | #9 (permalink) |
| DNOA Member | ... don't forget the ; at the end of the line.
__________________ codeboards A high-quality community of programmers -- Join today and post! We want new members! |
| |
| | #10 (permalink) |
| NamePros Regular | searching images by filename?! You'd be better off just showing a bazillion thumbnails... putting keywords in a database would be much more effective.
__________________ www.headlinercreative.com |
| |
| | #11 (permalink) |
| DNOA Member | Yeah, in fact, you should store each image in the database as a BLOB. I know it slows things down, but would be much more effecient otherwise. You could store the uploader's IP address with it as well, plus the upload date, time, and even keywords for searches! Then order them how you want, prune old images, etc, etc! It would be a fabulous alternative. Example - you could have a database table with these rows in it: imageid - BIGINT - 10 - UNSIGNED - auto_increment PRIMARY KEY (unique ID no.) imagedata - BLOB (this would be the actual image as binary) submitter_ip - TEXT (i just use text for this, but this is the IP address of the uploader) keywords - TEXT (seperate by spaces, maybe, then use explode() to search) date - DATE (upload date) time - TIME (time of upload) views - BIGINT - 10 Now, I added that last field in because you will have to access the image BLOB via a .php file, right? Why not keep track of the number of views an image gets? Might be a neat little extra feature. Just put this in the PHP file before it sends the image to the browser. Do whatever you like! ^_^
__________________ codeboards A high-quality community of programmers -- Join today and post! We want new members! |
| |
| | #13 (permalink) |
| Professional Monkey | DONT store images as a blob in a mysql database its not what its designed for and if your site recieves and traffic it will grind to stand still. just keep the images in a folder and record the filename and path in the mysql database.
__________________ [http://www.webmasterwords.com/python-split-and-join-examples]Python Tutorials[/url] |
| |
| | #14 (permalink) |
| DNOA Member | Do you realize how LARGE that folder will become? MySQL is designed to handle large databases! Large folders take longer to search through!
__________________ codeboards A high-quality community of programmers -- Join today and post! We want new members! |
| |
| | #15 (permalink) | |
| Professional Monkey | if you re-read my post Quote:
mySQl is designed for storing large amounts of data but that data should be in the form of many small records rather than few large records. Storing large files in Blobs is MESSY and should be avoided at all cost.
__________________ [http://www.webmasterwords.com/python-split-and-join-examples]Python Tutorials[/url] | |
| |
| | #16 (permalink) |
| DNOA Member | The point is, though, directories aren't built to handle hundreds, or thousands of files in them. Having lots in 1 directory is still going to slow it down, whether you know the filename or not.
__________________ codeboards A high-quality community of programmers -- Join today and post! We want new members! |
| |
| | #17 (permalink) | |
| Professional Monkey | Quote:
you can store thousands of files in a directory with very little reduction in speed if you look at a linux distros architecture some of the directories contain 10's of thousands of files so no offence but you're wrong a directory can be used to store A LOT of files.
__________________ [http://www.webmasterwords.com/python-split-and-join-examples]Python Tutorials[/url] Last edited by Amnezia; 08-11-2005 at 09:06 AM. | |
| |
| | #18 (permalink) |
| DNOA Member | Directories are designed to handle many SUBdirectories, to divide the files and make them easier to work with. Mikor - use MySQL blobs -_- They're much easier to handle. And no slower than storing the images in 1 directory.
__________________ codeboards A high-quality community of programmers -- Join today and post! We want new members! |
| |
| | #19 (permalink) | |
| Professional Monkey | i'm sorry but you have no idea what you're talking about. when you also have a degree in computer science we can sit down and discuss this on a level playing feild but until then prehaps you could refrain from giving out false information and bad advice Quote:
mysql becomes ALOT slower if you start using using blobs, if you read up about mySQL optimisation on the mySQL website you will see that they recommend avoiding storing binary objects in a database.
__________________ [http://www.webmasterwords.com/python-split-and-join-examples]Python Tutorials[/url] Last edited by Amnezia; 08-11-2005 at 09:27 AM. | |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| HOWTO: Install the Apache Web Server, Perl, PHP, and MySQL on Windows | deadserious | Webmaster Tutorials | 96 | 05-27-2007 01:24 PM |
| Googlism - What does google think of you? | deadserious | The Break Room | 55 | 12-15-2005 09:09 AM |
| Paypal Settlement | CMachuca | The Break Room | 3 | 07-31-2004 10:14 PM |
| Paypal Settlement | Lord | The Break Room | 2 | 07-30-2004 09:30 PM |
| 2 PPC sites with design | morpheus666 | Web Development Wanted | 1 | 02-28-2004 04:40 AM |