From: H P. <hp...@gm...> - 2007-04-10 05:20:58
|
Thanks Tom, I've been playing around a little with this, and have two questions and an idea; I'm a little confused about the photo_dirs mh.ini variable. I previously had these entries: html_alias_photos = /vol/local/images/mh-resized photo_dirs = /photos According to the photo_index.pl, the html alias points to the filesystem location, and photo_dirs points to the html location. This was how I configured things before. Using this resizer, photo_dirs now needs to point to the filesystem, so these should now read: html_alias_photos = /vol/local/images/mh-resized photo_dirs = /vol/local/images/mh-resized Is this correct? Secondly, as I have thousands of pictures, I liked Davids idea of only resizing new pictures. This would be something worthwhile to add. (I don't have any great ideas off the top of my head) And the idea. I modified the script to add the Proc::Simple perl module. This seems to fork off processes without bogging down MH. Something like: if ($state = said $v_resize_images) { my $process = Proc::Simple->new(); $process->start(\&resize_photos); } sub resize_photos { photo_dir($originals); <snip> On 4/8/07, Tom <tom...@gm...> wrote: > Google says it blocked my attachment... > The resize_image.pl has been blocked, > and Quarantine entire message has been taken on 4/8/2007 9:58:18 AM. > so I've inserted my code for resize_image.pl below.. > > ---------------------------- > #Category=Photos > #! /usr/bin/perl -w > # > # 20070408 This is based on code supplied by David Norwood > # Last modified by Tom Valdes > # This script resizes images and uses parameters from mh.ini > # > # The parameters it uses are: > # photo_originals = xxxxxx <---- This is the location of the original photos > # photo_dirs = xxxxxx <---- This is the location where the resized > photos are placed --- photo_index will index images in this l > ocation > # > # This causes MH to pause and the pause time depends on the amount of > images to be resized > # This should be forked, but I don't know how to do this.. Please > feel free to fork this process. > # > > #noloop=start > > my @photos; > my $originals = $config_parms{photo_originals}; > my $resized = $config_parms{photo_dirs}; > $v_resize_images = new Voice_Cmd 'Resize images'; > #noloop=stop > > if ($state = said $v_resize_images) { > photo_dir($originals); > > foreach (@photos) { > my $old = $_; > my $new = $_; > $new =~ s/$originals/$resized/; > # $new =~ s/'/\\'/g; > # $new =~ s/ /\\ /g; > if (! -e $new) { > my @dirs = split '/', $new; > pop @dirs; > shift @dirs; > my $dir = '/' . shift @dirs; > foreach (@dirs) { > $dir .= '/' . $_; > print "making directory $dir\n" unless -d $dir; > system 'mkdir "' . $dir . '"' unless -d $dir; > } > print " converting $new \n"; > # system 'convert -geometry 800x600 "' . $old . '" "' . > $new . '"'; > system 'convert -geometry 640x480 "' . $old . '" "' . > $new . '"'; # Uncomment this line to resize to fit Audrey > } > } > > sub photo_dir { > my ($dir2) = @_; > print " - Listing files from -> $dir2\n"; > opendir(DIR, $dir2) or print "Error in opening $dir2\n"; > for (readdir(DIR)) { > next if /^\.+$/; > &photo_dir("$dir2/$_") if -d "$dir2/$_"; # Recurse through subdirs > next unless /.+\.(jpg|jpeg|gif|png)$/i; > push @photos, "$dir2/$_"; > } > close DIR; > } > > } > --------------------------------- > > On 4/8/07, Tom <tom...@gm...> wrote: > > I modified the script to use variables in mh.ini > > here's the comment I added at the begining of the script > > ---------- > > # > > # The parameters it uses are: > > # photo_originals = xxxxxx <---- This is the location of the original photos > > # photo_dirs = xxxxxx <---- This is the location where the resized > > photos are placed --- photo_index will index images in this location > > # > > # This causes MH to pause and the pause time depends on the amount of > > images to be resized > > # This should be forked, but I don't know how to do this.. Please > > feel free to fork it. > > ---------- > > I don't know how to link it to the resulting search screen for photo > > which shows the Reindex and Resize options so I added $v_resize_images > > = new Voice_Cmd 'Resize images'; so it can be called using > > > > run_voice_cmd 'Resize images' > > > > I'm sure it's not the cleanest way to do it, but it seems to work well. > > > > --tom > > > > On 4/7/07, David Norwood <dno...@ya...> wrote: > > > I had this working a while ago, so things might have changed. I attached my > > > perl script. Even though it's a perl script, it needs to be named > > > resize_image.bat and it needs to go in your root directory. You need to > > > edit the directory names in it and will need the imagemagick package > > > installed. It should use the imagemagick perl extensions so it will work on > > > windows as well. > > > > > > David > > > > > > ----- Original Message ----- > > > From: "Tom" <tom...@gm...> > > > To: "The main list for the MisterHouse home automation program" > > > <mis...@li...> > > > Sent: Friday, April 06, 2007 2:36 PM > > > Subject: Re: [mh] Help with photos > > > > > > > > > > What shell script needs to be customized? > > > > > > > > On 4/6/07, David Norwood <dno...@ya...> wrote: > > > >> The image resize stuff needs to be rewritten. Right now it requires each > > > >> user to customize a batch file or shell script to do the resize. It > > > >> should > > > >> really be a perl script that uses imagemagick, reads and supports all the > > > >> photo ini parameters, and checks the timestamps of resized images so it > > > >> doesn't process ones that are up to date. > > > >> > > > >> David > > > >> > > > >> ----- Original Message ----- > > > >> From: "Tom" <tom...@gm...> > > > >> To: "The main list for the MisterHouse home automation program" > > > >> <mis...@li...> > > > >> Sent: Wednesday, April 04, 2007 10:41 AM > > > >> Subject: Re: [mh] Help with photos > > > >> > > > >> > > > >> > I'm also having trouble with resizing the image. > > > >> > When I click on "Resize new photo album pictures" > > > >> > MH shows the following: > > > >> > > > > >> > ------------------------------- > > > >> > 04/04/07 01:35:09 PM Running: Resize new photo album pictures > > > >> > normal: Resizing photos... > > > >> > Warning, new Process: Can not find path to > > > >> > pgm=d:/pictures/resize_images.bat, pgm_path= arg= > > > >> > ------------------------------- > > > >> > Do I need to change a variable so /usr/local/mh/bin/image_resize is > > > >> > found? > > > >> > > > > >> > thanks, > > > >> > tom > > > >> > > > > >> > On 4/4/07, Tom <tom...@gm...> wrote: > > > >> >> It find the photos only if I leave the default in the mh.ini > > > >> >> > > > >> >> photo_dirs = $Pgm_Root/data/photos @ Can be a comma > > > >> >> delimited > > > >> >> list. > > > >> >> > > > >> >> If I try either of the following it does not find them > > > >> >> > > > >> >> photo_dirs = $config_parms{data_dir}/photos @ Can be a > > > >> >> comma delimited list. > > > >> >> photo_dirs = /tmp/photos @ Can be a comma delimited list. > > > >> >> > > > >> >> On 4/4/07, Tom <tom...@gm...> wrote: > > > >> >> > I had this working a long time ago and then disabled it. > > > >> >> > I'm trying to get this working again but am stuck. > > > >> >> > > > > >> >> > Can someone post a step by step. > > > >> >> > > > > >> >> > I've defined my photo directory and the location of my > > > >> >> > photo_index.txt > > > >> >> > but when I click "Reindex the photo album", MH shows > > > >> >> > > > > >> >> > ---------- > > > >> >> > 04/04/07 12:12:08 PM Reading photos that match photo_filer parm > > > >> >> > *.jpg > > > >> >> > from photo_dirs parm /tmp/photos > > > >> >> > Read parameter files: ./mh.ini ./mh.private.ini > > > >> >> > /data/mh/toms_stuff/mh.private.ini > > > >> >> > - Listing files from /tmp/photos -> > > > >> >> > Error in opening > > > >> >> > normal: Indexed 0 photos > > > >> >> > ---------- > > > >> >> > > > > >> >> > thanks, > > > >> >> > tom > > > >> >> > > > > >> >> > > > >> > > > > >> > ------------------------------------------------------------------------- > > > >> > Take Surveys. Earn Cash. Influence the Future of IT > > > >> > Join SourceForge.net's Techsay panel and you'll get the chance to share > > > >> > your > > > >> > opinions on IT & business topics through brief surveys-and earn cash > > > >> > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > >> > ________________________________________________________ > > > >> > To unsubscribe from this list, go to: > > > >> > http://sourceforge.net/mail/?group_id=1365 > > > >> > > > > >> > > > >> > > > >> ------------------------------------------------------------------------- > > > >> Take Surveys. Earn Cash. Influence the Future of IT > > > >> Join SourceForge.net's Techsay panel and you'll get the chance to share > > > >> your > > > >> opinions on IT & business topics through brief surveys-and earn cash > > > >> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > >> ________________________________________________________ > > > >> To unsubscribe from this list, go to: > > > >> http://sourceforge.net/mail/?group_id=1365 > > > >> > > > >> > > > > > > > > ------------------------------------------------------------------------- > > > > Take Surveys. Earn Cash. Influence the Future of IT > > > > Join SourceForge.net's Techsay panel and you'll get the chance to share > > > > your > > > > opinions on IT & business topics through brief surveys-and earn cash > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > > ________________________________________________________ > > > > To unsubscribe from this list, go to: > > > > http://sourceforge.net/mail/?group_id=1365 > > > > > > > > > > ------------------------------------------------------------------------- > > > Take Surveys. Earn Cash. Influence the Future of IT > > > Join SourceForge.net's Techsay panel and you'll get the chance to share your > > > opinions on IT & business topics through brief surveys-and earn cash > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > ________________________________________________________ > > > To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365 > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > ________________________________________________________ > To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365 > > |