Mail Index


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ApacheGallery] Rotating and comment on images



Hi!

I wonder if annyone has been doing some work on functions to rotate and comment on the images via the web? I.e. a web user interface to create and modify [imagename].rotate and [imagename].comment files.

I'm aware that this means that the web server user has to have write privileges in the image directory but my plan is to use two separate processes. One with privileges that use access control as well, and one public.

I have added some code (below) to my Apache/Gallery.pm in order to make it able to rotate images.

Preferably I would like to set a "PerlSetVar GalleryRotateMode 1" and maybe GalleryCommentMode (or some better name) in the httpd.conf to enable these funktions.

I'm a bit comfused about the SelectionMode (which has to be disabled if rotate or rotateback is sent) as it doesnt seem to work for me and I don't se the reason for it, so anyway...

Any comments?

Have a happy new year!
Erik Melkersson

---
   # Handle rotating selected images
   if ($cgi->param('selection') && ($cgi->param('rotate') ||
                    $cgi->param('rotateback'))) {
       my @selected = $cgi->param('selection');

       # Get directory path
       my $dirname = $r->filename;
       $dirname =~ s/\/$//;

       # Create (or remove) a .rotate-file per image
       foreach my $file (@selected) {
       my $dir = 0;

       if (open (FILE, "$dirname/$file.rotate")) {
           $dir = <FILE>;
           close FILE;
       }

       $dir = ($dir + 1) % 4 if $cgi->param('rotate');
       $dir = ($dir + 3) % 4 if $cgi->param('rotateback');
if ($dir > 0) {
           open (FILE, ">$dirname/$file.rotate");
           print FILE $dir;
           close FILE;
       } else {
           unlink ("$dirname/$file.rotate");
       }
       }
   }

---

$tpl->assign(FORM_END => $select_mode?'<input type="submit" name="rotateback" value="Rotate back"><input type="submit" name="rotate" value="Rotate"></form>':'');



_______________________________________________
users mailing list
users@xxxxxxxxxxxxxxxx
http://ufo.hestdesign.com/cgi-bin/mailman/listinfo/agusers