| | |
Urgently need -php script for searching image
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Dec 2008
Posts: 19
Reputation:
Solved Threads: 1
Hi
can anybody help me?
I am working in a networked system. Just i want to search all the images in the H: drive. What i am exactly trying to say is, i want a search program exactly as 'istockphoto.com' of my own. Could you tell me this is possible for writing code in php.
Pleeeeeeeeeeeeeeeeease very urgent!
can anybody help me?
I am working in a networked system. Just i want to search all the images in the H: drive. What i am exactly trying to say is, i want a search program exactly as 'istockphoto.com' of my own. Could you tell me this is possible for writing code in php.
Pleeeeeeeeeeeeeeeeease very urgent!
•
•
Join Date: Dec 2008
Posts: 20
Reputation:
Solved Threads: 1
PHP Syntax (Toggle Plain Text)
<?php function isImage($fileName) { $ext = substr(strrchr($fileName, '.'), 1); if($ext <> "") { $ext = strtolower($ext); switch($ext) { case 'gif': return true; case 'jpeg': return true; case 'png': return true; case 'psd': return true; case 'bmp': return true; case 'tiff': return true; case 'jp2': return true; case 'iff': return true; case 'ico': return true; default: return false; } } else return false; } function ListMyFiles($dir,$MySearchFile) { if($dh = opendir($dir)) { $files = Array(); $inner_files = Array(); while($file = readdir($dh)) { if($file != "." && $file != ".." && $file[0] != '.') { if(is_dir($dir . "/" . $file)) { $inner_files = ListMyFiles($dir . "/" . $file,$MySearchFile); if(is_array($inner_files)) $files = array_merge($files, $inner_files); } else { if($MySearchFile == "") { if(isImage($file)) { array_push($files, $dir . "/" . $file); } } else if ( strstr( $file,$MySearchFile ) ) { if(isImage($file)) { array_push($files, $dir . "/" . $file); } } } } } closedir($dh); return $files; } } //NOTE : if u don't want to search by keywords plesae keep this field blank $MySearchFile = "test"; foreach(ListMyFiles('includes/',$MySearchFile) as $file_name) { echo "<br>".$file_name; } ?>
-- Manish Singh
manish.s@neuralit.com
manish.s@neuralit.com
•
•
Join Date: Dec 2008
Posts: 19
Reputation:
Solved Threads: 1
•
•
•
•
PHP Syntax (Toggle Plain Text)
<?php function isImage($fileName) { $ext = substr(strrchr($fileName, '.'), 1); if($ext <> "") { $ext = strtolower($ext); switch($ext) { case 'gif': return true; case 'jpeg': return true; case 'png': return true; case 'psd': return true; case 'bmp': return true; case 'tiff': return true; case 'jp2': return true; case 'iff': return true; case 'ico': return true; default: return false; } } else return false; } function ListMyFiles($dir,$MySearchFile) { if($dh = opendir($dir)) { $files = Array(); $inner_files = Array(); while($file = readdir($dh)) { if($file != "." && $file != ".." && $file[0] != '.') { if(is_dir($dir . "/" . $file)) { $inner_files = ListMyFiles($dir . "/" . $file,$MySearchFile); if(is_array($inner_files)) $files = array_merge($files, $inner_files); } else { if($MySearchFile == "") { if(isImage($file)) { array_push($files, $dir . "/" . $file); } } else if ( strstr( $file,$MySearchFile ) ) { if(isImage($file)) { array_push($files, $dir . "/" . $file); } } } } } closedir($dh); return $files; } } //NOTE : if u don't want to search by keywords plesae keep this field blank $MySearchFile = "test"; foreach(ListMyFiles('includes/',$MySearchFile) as $file_name) { echo "<br>".$file_name; } ?>
Hi,
Manish. Thanks for giving a remedy for my problem. But it shows some warning in opendir() that directory does not exist.
What shall i do?
•
•
Join Date: Aug 2007
Posts: 8
Reputation:
Solved Threads: 0
•
•
•
•
Hi
can anybody help me?
I am working in a networked system. Just i want to search all the images in the H: drive. What i am exactly trying to say is, i want a search program exactly as 'istockphoto.com' of my own. Could you tell me this is possible for writing code in php.
Pleeeeeeeeeeeeeeeeease very urgent!
Are you publishing for other users on the internet like istockphoto (and offering for sale??) or do you just want to see your own pictures?
If it's just you and your own drive, try something like Google's free Picasa program. Otherwise look at some of the opensource php apps at sourceforge.net. Other than "searching", you are not being very specific about your needs, but there are several projects that are similar to what you describe.
•
•
Join Date: Dec 2008
Posts: 19
Reputation:
Solved Threads: 1
Hi,
Thank you very much for guiding me to get 'Google picasa'. This is what i am exactly wanted. But it displays all my pictures images in my computer only. When i want to search images in other system (Just i am working in a networked environment and i must share all images in all system), it displays some warning. could you help me about this problem?
Once again Thanks a lot!!!!!!!!!!!!!!!!!!!!.
Thank you very much for guiding me to get 'Google picasa'. This is what i am exactly wanted. But it displays all my pictures images in my computer only. When i want to search images in other system (Just i am working in a networked environment and i must share all images in all system), it displays some warning. could you help me about this problem?
Once again Thanks a lot!!!!!!!!!!!!!!!!!!!!.
•
•
Join Date: Aug 2007
Posts: 8
Reputation:
Solved Threads: 0
•
•
•
•
Hi,
When i want to search images in other system (Just i am working in a networked environment and i must share all images in all system), it displays some warning. could you help me about this problem?
Hope that helps.
![]() |
Other Threads in the PHP Forum
- Previous Thread: need help in php forms..plz
- Next Thread: Preg_Match? Explode? Please Help :D!
| Thread Tools | Search this Thread |
ajax apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date display dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail mediawiki menu mlm msqli_multi_query multiple mysql number oop paypal pdf php phpincludeissue phpmyadmin problem query radio random recursion regex remote script search server sessions sms soap source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign websphere white wordpress xml youtube





