| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| Senior Member Join Date: Aug 2005 Location: East Yorkshire, England
Posts: 2,689
![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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. |
| |
| | #5 (permalink) |
| Professional Monkey Join Date: Jul 2005 Location: Escaped from the zoo
Posts: 907
![]() ![]() | you can do it without mysql what is the search criteria for the images?
__________________ Webmaster Words |
| |
| | #6 (permalink) |
| NamePros Member Join Date: Jan 2005 Location: Texas USA
Posts: 71
![]() | 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 05:09 PM.
|
| |
| | THREAD STARTER #7 (permalink) |
| Senior Member Join Date: Aug 2005 Location: East Yorkshire, England
Posts: 2,689
![]() ![]() ![]() ![]() ![]() ![]() ![]() | thanks, i'll test it when i can get PHP on my webserver working. ive just realized something.. I dont know how to use URL parameters in PHP, whats the syntax to get the parameter? |
| |
| | #8 (permalink) |
| NamePros Member Join Date: Jan 2005 Location: Texas USA
Posts: 71
![]() | PHP Code: to get that, use PHP Code:
__________________ I wonder... |
| |
| | #10 (permalink) |
| NamePros Regular Join Date: Jul 2005 Location: Florida
Posts: 233
![]() | 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 Join Date: May 2004
Posts: 5,040
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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) ????: NamePros.com http://www.namepros.com/showthread.php?t=113818 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! ^_^ |
| |
| | #12 (permalink) | ||||
| NamePros Member Join Date: Jan 2005 Location: Texas USA
Posts: 71
![]() |
I agree that mysql is a better option...
__________________ I wonder... | ||||
| |
| | #13 (permalink) |
| Professional Monkey Join Date: Jul 2005 Location: Escaped from the zoo
Posts: 907
![]() ![]() | 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.
__________________ Webmaster Words |
| |
| | #15 (permalink) | ||||
| Professional Monkey Join Date: Jul 2005 Location: Escaped from the zoo
Posts: 907
![]() ![]() | if you re-read my post
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.
__________________ Webmaster Words | ||||
| |
| | #17 (permalink) | ||||
| Professional Monkey Join Date: Jul 2005 Location: Escaped from the zoo
Posts: 907
![]() ![]() |
????: NamePros.com http://www.namepros.com/showthread.php?t=113818 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.
__________________ Webmaster Words
Last edited by Amnezia; 08-11-2005 at 10:06 AM.
| ||||
| |
| | #18 (permalink) |
| DNOA Member Join Date: May 2004
Posts: 5,040
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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. |
| |
| | #19 (permalink) | ||||
| Professional Monkey Join Date: Jul 2005 Location: Escaped from the zoo
Posts: 907
![]() ![]() | 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
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.
__________________ Webmaster Words
Last edited by Amnezia; 08-11-2005 at 10: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 02:24 PM |
| Googlism - What does google think of you? | deadserious | The Break Room | 55 | 12-15-2005 10:09 AM |
| Paypal Settlement | CMachuca | The Break Room | 3 | 07-31-2004 11:14 PM |
| Paypal Settlement | Lord | The Break Room | 2 | 07-30-2004 10:30 PM |
| 2 PPC sites with design | morpheus666 | Web Development Wanted | 1 | 02-28-2004 05:40 AM |