Question : tagging files to be zipped for download

Using Linux and Perl, I'd like to create some code that would like to do one of either two functions:

1. dynamically tag all the images that a "member" views and place them in a zip file to be downloaded. I'd like to place the tag in the EXIF or the IPTC sections of the JPG files. The trick with this one is that many members can be accessing the files so need to keep them all separated.

or

2. dynamically tag an already created zip file with the "membe's" info so that if they download it we can see who downloaded it...

Yes we are having trader and file sharing issues.

I started playing with exiftool as in the included shell script -- but that is a kludge
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
#!/bin/sh
 
MNAME="testuser"
COPYRIGHT="(C) BSWare Inc all rights reserved"
 
exiftool -v \
  -ext .JPG \
  -out out/ \
  -preserve \
  -CreateDate-=::38\ :: \
  -DateTimeOriginal-=::38\ :: \
  -ProcessingSoftware=${MNAME} \
  -DocumentName ${MNAME} \
  -DocumentNotes ${MNAME} \
  -Software ${MNAME} \
  -SecurityClassification ${MNAME} \
  -HostComputer ${COPYRIGHT} \
  -Copyright ${COPYRIGHT} \
  .
 
#exiftool -v -DateTimeOriginal-=::38\ :: .
#exiftool -v -CreateTime-=::38\ :: .
exiftool -h out/P1098521* > date.html
 
exit
exiftool -v -AllDates-=::38\ :: .
exiftool
exiftool "-DateTimeOriginal=2008:12:01" .
exiftool "-DateTimeOriginal-=0:1:7" .
exiftool "-DateTimeOriginal-=0:1:7" .
exiftool -v
exiftool -ver
exiftool -ver
exiftool "-DateTimeOriginal=::-38" .
exiftool "-DateTimeOriginal-=::38" .
exiftool -h P1098521*
exiftool -h P1098521* > date.html
exiftool -h P1098521* > date.htmlcd ..
exiftool "-AllDates-=::38" .
exiftool -h P1098521* > date.html
exiftool -AllDates-=::38 .
exiftool -h P1098521* > date.html
exiftool -v -AllDates-=38 .
exiftool -h P1098521* > date.html
Open in New Window Select All

Answer : tagging files to be zipped for download

Okay... what you will need to do is setup your webserver so members can't directly download the image files.
Then create a perl script that will get the images, but modified in some way, and return the modified image.

Note that if you use exif/iptc, it is possible the user could remove the data.

But here is some code that will return a jpg image with the Description indicating the user.

To use, you'd have your images be something like:
    www.yoursite.com/cgi-bin/getimage.pl?ImageName=someimage.jpg

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
#!/usr/bin/perl
use strict;
use warnings;
use CGI ':standard';
use Image::ExifTool;
 
my $user='some_user';  #Do whatever you need to determine the user
my $requestedimage=param('ImageName');
 
my $exifTool = new Image::ExifTool;
 
$exifTool->SetNewValue('Description', "Downloaded by $user")
  or die "Could not set new value: $@\n";
 
my $data = '';
$exifTool->WriteInfo("/path/to/images/$requestedimage", \$data)
  or die "Could not write: $@\n";
 
print header('image/jpeg');  #or whatever image type
binmode STDOUT;
print $data;
Open in New Window Select All
Random Solutions  
 
programming4us programming4us