ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE. Software > Post New Requests Here

IDEA: Find pics in required orientation on PC for digital frame

(1/4) > >>

Hi DCers
Had a great idea :D for the guru programmers out there in DC Land as I am trying to get a digital frame ready with pics to send to dear old Mom and Dad as a gift:
It would be great if there was an utility that would search a user-selected folder (with the option to search sub-folders if desired) for certain types of files (e.g. JPGs), but it would need to find only pics that were Landscape orientation (or Portrait depending on the user-selected preference), because most people will either have their digital-frame in either Landscape (or Portrait) mode and wouldn't want the pics in the other orientation to show up as they would not fit the screen. Once the pics are found, it would then copy them to a user-selected folder.
Would anyone know how to code this and give us a working example?
This would save me many hours right now as I am going through all the hundreds of camera pics on PC to find ones that Mom and Dad have not seen/been sent of the kiddos, but I then have to choose which ones are the correct orientation for the frame.
If the digital-frame size (e.g. 5". 7" etc.) is relevant to the pixel size of the pics (e.g. 800x600), then the app could recommend (via an on-screen message) the best setting to resize the newly found pics. There are many apps out there that resize just fine so adding to it wouldn't be needed I guess.
What do you all think of this idea?

I made you a PHP script :Thmbsup:

--- Code: PHP ---<?php $folder = './';$subfolders = true;$extension = 'jpg';$orientation = 'L';$copytofolder = 'C:/Images/'; if (!is_dir ($folder)){echo ($folder . ' doesn\'t exist.');}elseif (!is_dir ($copytofolder)){echo ($copytofolder . ' doesn\'t exist.');}else{getImages ($folder, $subfolders, $extension, $orientation, $copytofolder);}function getImages ($folder, $subfolders, $extension, $orientation, $copytofolder){$files = opendir ($folder);while ($image = readdir ($files)){if (is_dir ($folder . '/' . $image)){if ($subfolders && $image != '.' && $image != '..'){getImages ($folder . '/' . $image, $subfolders, $extension, $orientation, $copytofolder);}}elseif (substr ($image, -1 - strlen ($extension)) == '.' . $extension){list ($width, $height) = getimagesize ($folder . '/' . $image);if (strtolower ($orientation) == 'p' && $height > $width){echo ('Copying ' . $image . '...');fwrite (fopen ($copytofolder . '/' . $image, 'w'), file_get_contents ($folder . '/' . $image));}if (strtolower ($orientation) == 'l' && $height < $width){echo ('Copying ' . $image . '...');fwrite (fopen ($copytofolder . '/' . $image, 'w'), file_get_contents ($folder . '/' . $image));}}}}?>

thanks! Excuse my ignorance, but how do I apply this PHP script to my folder on my computer? I have *no* idea how to implement this.

If you want I can make a version that's easier to use.

To run the program:
1. Change the parameters at the top of the script to set the folders/options.
2. Save the script as a .php file.
3. Install PHP:
4. Open a command prompt and say: php C:\directory\scriptfile.php

I would be most grateful if you could make one that's easier to use.
Thank you for your help so far :-)


[0] Message Index

[#] Next page

Go to full version