Shutterfly comment field?
benfrantzdale
Joined: 2003-03-25
Posts: 8 |
Posted: Fri, 2003-03-28 03:39 |
Does anyone know if the Shutterfly link automatically fills out the "Message to print on back" field? From the source of Shutterfly's page, here's the relevant part: I'd like to be able to set "value" with some CGI field if that's possible. In particular I'd like to have exposure information printed on the back of my prints. --Ben |
|
Posts: 8
I asked shutterfly and got an API doc (See below.)
It turns out that gallery was trying to use it, but there's a typo in the CGI field name.
On about line 492 is the field named "imbkprntb-1". It should be named "imbkprnta-1". Also, right now all that says is "Hi". I'd suggest replacing it all with this line:
<input type=hidden name=imbkprnta-1 value="<?php echo editCaption($gallery->album, $index, $edit) ?>">
That simpy attaches the Gallery comment.
I am investigating putting the image metadata in that field as well, for example "3/29/2003 15:58:08 127mm 1/100 f/5.0". I have a perl script to give me that string from any picture, but I need to look at a PHP reference to see how to include it.
Posts: 8
The API reference is here: http://www.cs.hmc.edu/~ben/c4p_API_v2.html
Posts: 8
The API reference is here: http://www.cs.hmc.edu/~ben/c4p_API_v2.html
Posts: 8
Here's the perl script. I'm sure someone could port it PHP easily enough:
#!/usr/bin/perl
$jhead = '/home/ben/public_html/gallery/jhead/jhead';
<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
foreach $arg(@ARGV) {
@rows = `$jhead $arg`;
#print STDERR join("", @rows);
foreach $row(@rows) {
chomp $row;
$output = "";
if($row =~ /Date/Times+:s+(.*)/) {
$output = ;
$output =~ s/(d{4}):0?(d{1,2}):0?(d{1,2})////;
} elsif ($row =~ /Flash useds+:s*Yes/i) {
$output = "Flash";
} elsif ($row =~ /Exposure time:.*((.*))/i) {
$output = ;
} elsif ($row =~ /Aperture :s+(.*)/) {
$output = ;
} elsif ($row =~ /Focal length :.*(35mm equivalent: (.*))/) {
$output = ;
}
$output =~ s/^s*//;
$output =~ s/s*$//;
if($output ne "") {
print "$output ";
}
}
print "
";
}
</TD></TR></TABLE><!-- BBCode End -->
I'm sure improvements could be made and this is probably speciffic to my camera, but it's a start.
I did the following in PHP:
<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>$imageInfo = system("/home/ben/public_html/gallery/simpleData.pl " .
escapeshellarg($gallery->album->getAlbumDir() . "/" .
$photo->image->name . "." .
$photo->image->type)
);
</TD></TR></TABLE><!-- BBCode End -->
Knowing little about PHP or Gallery works, I added that view_photo.php after the <!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>$rawImage =...</TD></TR></TABLE><!-- BBCode End --> line and then echoed <!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>$imageInfo</TD></TR></TABLE><!-- BBCode End --> into the Shutterfly comment field. This had the side effect of putting that text between the picture and the caption, which is what I wanted anyway. I think that has to do with system() printing it's output as well as returning it. I'd love to see the RightWay to do it.