x
Yes
No
Do you want to visit DriveHQ English website?
Inicio
Características
Precios
Prueba gratuita
Software cliente
Acerca de nosotros
Servidor de archivos
|
Solución de copias de seguridad
|
Servidor FTP
|
Servidor de correo electrónico
|
Alojamiento web
|
Software cliente
Servidor de archivos
Solución de copia de seguridad
Servidor FTP
Servidor de correo electrónico
Alojamiento web
Software cliente
iptc_keywords.pl - Hosted on DriveHQ Cloud IT Platform
Arriba
Subir
Descargar
Compartir
Publicar
Nueva carpeta
Nuevo archivo
Copiar
Cortar
Eliminar
Pegar
Clasificación
Actualizar
Ruta de la carpeta: \\LITTLELEV\ImageFolioLite\admin\iptc_keywords.pl
Girar
Efecto
Propiedad
Historial
############################################################################### # BizDesign ImageFolio Lite Edition 4.2 (Four-dot-Two) ############################################################################### # # ## ### VERSION : 4.2 # #### ## ## RELEASED ON : 02/15/2007 # ## ## ## LAST MODIFIED : 02/15/2007 # ########## ## # ## ### ## # ## ### ######## # ############################################################################### # Released by BizDesign, Inc. # written by Dirk Koppers and Greg Raaum of BizDesign # # Purchasing : http://imagefolio.com/purchase/ # Support : http://imagefolio.com/support/ # Phone : (214) 642-9787 # Email : sales@bizdesign.com ############################################################################### # COPYRIGHT AND LICENSE INFORMATION : # # Copyright (c) 1999-2007 BizDesign, Inc. All rights reserved. # # Selling or distributing the code for this program without prior written # consent is expressly forbidden. # # One licensed copy of the program may reside on a single server, in use by a # single domain. For each installed instance of the program, a separate # license is required. # # Licensed users may alter or modify this software, at their own risk, of # course. They may also hire others to modify their own copy of the code, as # long as the code is not transferred to or retained by the individual who is # hired (unless he/she is also a license holder). Although license-holders # may modify the code for their use, modified code may NOT be resold or # distributed. # # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BIZDESIGN, # INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # # BizDesign, Inc. is not liable for any conduct associated with image gallery # activity, nor for any binary media posted using this program, including but # not imited to images, photographs, movies, and clipart. # # The user must assume the entire risk of using the program. Although this # program has been thoroughly tested on BizDesign's servers, BizDesign does not # warrant that it works on all servers and will not be held liable for anything, # including but not limited to, misusage, error, or loss of data. ANY # LIABILITY OF THE SELLER WILL BE LIMITED EXCLUSIVELY TO PRODUCT REPLACEMENT # OR REFUND OF PURCHASE PRICE. Use at your own risk! ############################################################################### # Do not modify below this line unless you know what you are doing. ############################################################################### $ADDFILEINFO = "active"; ############################################################################### # STEP 1 # If we don't receive any information we display the list of categories ############################################################################### sub keywords_step_1 { $pagetitle = "Add File Info (IPTC) - Select A Category"; &get_header; &get_catlist; print qq|
<$admin_big_font>
Add File Info: Select A Category
<$admin_big_font>
Step 1 of 3
$catlist
Note:
The IPTC standard allows you to embed information (fields and values) into the header of an image. More information can be found here:
$if_images_directory/iptc.html
Some other programs that support the IPTC standard, and thus are compatible with ImageFolio, are:
Bibble
-
QPict
-
Caption Extractor Suite
-
CaptionEZ Pro
-
Cpicture
-
Extensis Portfolio
-
Fotostation Pro
-
Freehand
-
Graphic Converter
-
Image Archivist
-
ImageMagick
-
IMatch
-
iView MediaPro
-
Photo Mechanic
-
PhotoLibrary
-
Photoshop
-
PixView
-
ThumbsPlus
|; &get_footer; } ############################################################################### # STEP 2 # If we don't receive any information we display the list of categories ############################################################################### sub keywords_step_2 { &get_imagelist; $pagetitle = "Add File Info (IPTC) - Select An Image"; &get_header; $newcategory = $category; $newcategory =~ s/_/ /g; $newcategory =~ s/\// \> /g; if ($image) { $imagesource = "$imageurl/$category/$image"; $imagesource =~ s/([^a-zA-Z0-9$ignore_chars])/'%' . sprintf("%2x", ord($1))/ge; } else { $imagesource = $if_images_directory . "/image_viewer.gif"; } $js_category = $category; $js_category =~ s/([^a-zA-Z0-9$ignore_chars])/'%' . sprintf("%2x", ord($1))/ge; print qq|
|; if ($keywords && $kwstep eq "final") { if (!$imagefound) { print qq|<$admin_font>
Error: Could not save IPTC File Info to
$image ($newcategory)
|; } else { $iptc_category = $category; $iptc_image = $iptcthumbimage; &iptc_create_table; print qq|<$admin_font>
IPTC File Info saved successfully to
$image ($newcategory)
Here is the result (don't forget to rebuild the index before the keywords are searchable):
$iptc_table
|; } } print qq|
<$admin_font>
Instructions:
Select an image from the select box on the left to view it in the image viewer on the right. To add or modify the selected image's IPTC File Info, click "Add IPTC File Info"
<$admin_big_font>
Add File Info: Select An Image
<$admin_big_font>
Step 2 of 3
<$admin_small_font>$newcategory
<$admin_small_font>$totalnames found
$imagelist
|; &get_footer; } ############################################################################### # STEP 3 # We display a form for adding/modifying keywords ############################################################################### sub keywords_step_3 { $pagetitle = "Add File Info (IPTC) - Add or Modify IPTC File Info"; &get_header; #print "Content-type: text/html\n\n"; &get_keyform; &get_image_info; $newcategory = $category; $newcategory =~ s/_/ /g; $newcategory =~ s/\// \> /g; $image_preview = "$imageurl/$category/$image"; $image_preview =~ s/([^a-zA-Z0-9$ignore_chars])/'%' . sprintf("%2x", ord($1))/ge; $thisimage =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; print qq|
<$admin_font>
Instructions:
Add or modify IPTC file info in the text areas below, then click "Save IPTC File Info". Be sure to separate each keyword with a space only, NOT a comma or separate line. There are 42 IPTC tags available and 20 custom, non-IPTC tags (marked with
*
). Please use the Configuration Editor to display more, less, or all the IPTC fields/tags, and optionally, make them searchable.
<$admin_big_font>
Add File Info: Add or Modify IPTC File Info
Step 3 of 3
<$admin_small_font>$newcategory
$keyform
|; &get_footer; } ############################################################################### # FINAL # We save the Keywords to the database then display step 2 again ############################################################################### sub keywords_final { require "$libpath/iptc.pl"; if ($FORM{'admin'} eq 'admin_caption_image') { $category = $admin_directory; $iptc_category = $admin_directory; $rank = 4; foreach $admin_image (@admin_images) { $admin_image =~ s/some_secret_code_17_/$mypattern_fullsize/ig; if (($admin_image =~ /^$mypattern_fullsize/i) && ($rank > 1)) { $upload_date_image = $admin_image; $rank = 1; } elsif (($admin_image !~ /^$mypattern/i) && (-B "$image_directory/$category/$admin_image") && ($rank > 2)){ $upload_date_image = $admin_image; $rank = 2; } elsif (($admin_image =~ /^$mypattern/i) && ($rank > 3)) { $upload_date_image = $admin_image; $rank = 3; } } ($filedate) = (stat("$image_directory/$category/$upload_date_image"))[9]; foreach $admin_image (@admin_images) { $admin_image =~ s/some_secret_code_17_/$mypattern_fullsize/ig; ($extension) = ($admin_image =~ /\.([^.]+)$/); # if (lc($extension) eq 'jpg' && ($admin_image !~ /^$mypattern_fullsize/)) { if (lc($extension) eq 'jpg') { $iptc_image = $admin_image; $error_image = $admin_image; $createinfo = create Image::IPTCInfo("$image_directory/$category/$admin_image") or &Error ("Could not open $category/$error_image. Reason: $!"); &createinfo_final; $admin_image_list .= qq|$admin_image
|; } } } else { $iptcthumbimage = $image; $iptcfullimage = $image; $iptcfullimage =~ s/$mypattern//ig; ($fullsize_name) = $iptcfullimage =~ m,^(.*)\.\w+$,; ($my_extension) = ($iptcfullimage =~ /\.([^.]+)$/); $my_lc_key = lc($my_extension); $my_uc_key = uc($my_extension); if (-e "$image_directory/$category/$iptcfullimage") { $my_iptcfullimage = "$image_directory/$category/$iptcfullimage"; $my_error_image = $iptcfullimage; } elsif (-e "$image_directory/$category/$fullsize_name.$my_lc_key") { $my_iptcfullimage = "$image_directory/$category/$fullsize_name.$my_lc_key"; $my_error_image = "$fullsize_name.$my_lc_key"; } elsif (-e "$image_directory/$category/$fullsize_name.$my_uc_key") { $my_iptcfullimage = "$image_directory/$category/$fullsize_name.$my_uc_key"; $my_error_image = "$fullsize_name.$my_uc_key"; } $fullsize_name = qq|$mypattern_fullsize$fullsize_name.$myextension_fullsize|; if (-e "$image_directory/$category/$fullsize_name") { $upload_date_image = $fullsize_name; } elsif ($my_iptcfullimage){ $upload_date_image = $my_error_image; } else { $upload_date_image = $iptcthumbimage; } ($filedate) = (stat("$image_directory/$category/$upload_date_image"))[9]; $error_image = $iptcthumbimage; $createinfo = create Image::IPTCInfo("$image_directory/$category/$iptcthumbimage") or &Error ("Could not open $image_directory/$category/$error_image. Reason: $!"); &createinfo_final; if ($my_iptcfullimage) { $error_image = $my_error_image; $createinfo = create Image::IPTCInfo("$my_iptcfullimage") or &Error ("Could not open $my_iptcfullimage. Reason: $!"); &createinfo_final; } $keywords = 1; $imagefound = 1; &keywords_step_2; } } sub createinfo_final { if (!$admin_approve_image) { foreach $key (sort keys %IPTCfields) { $iptcattribute = $IPTCfields{$key}[1]; $iptcattributeform = $iptcattribute; $iptcattributeform =~ s/\///g; $iptcattributeform =~ s/\s+//g; $iptcattributeform =~ s/\-//g; $FORM{"$iptcattributeform"} =~ s/\n/ /g; # Change newline to a space. $FORM{"$iptcattributeform"} =~ s/\r//g; # Remove Windows linefeed character. $FORM{"$iptcattributeform"} =~ s/\s+\s+/ /g; # Change two spaces to one. $FORM{"$iptcattributeform"} =~ s/\s+\s+/ /g; # Change two spaces to one again. $FORM{"$iptcattributeform"} =~ s/^\s//g; # Trim leading blanks... $FORM{"$iptcattributeform"} =~ s/\s+$//g; # Trim trailing blanks... if ($iptcattribute eq 'keywords') { $createinfo->ClearKeywords(); if ($FORM{"$iptcattributeform"}){ @keywords = split(/\s+/, $FORM{"$iptcattributeform"}); foreach $keyword (@keywords) { $keyword =~ s/\,//g; # Remove comma's. $createinfo->AddKeyword("$keyword"); } } } else { if ($iptcattribute =~ /date/i) { my @dates = split(/\//, $FORM{"$iptcattributeform"}); if ($eu_date_format) { $FORM{"$iptcattributeform"} = @dates[2] . @dates[1] . @dates[0]; } else { $FORM{"$iptcattributeform"} = @dates[2] . @dates[0] . @dates[1]; } } next if ($iptcattribute eq 'custom18'); $createinfo->SetAttribute("$iptcattribute",$FORM{"$iptcattributeform"}); } } } $attribute_custom18 = (); $custom18_user = (); $custom18_email = (); $custom18_approval = (); $custom18_file_type = (); $attribute_custom18 = $createinfo->Attribute('custom18'); if ($attribute_custom18 !~ /\D/) { $custom18_date = $attribute_custom18; } else { ($custom18_date, $custom18_user, $custom18_email, $custom18_approval, $custom18_file_type) = $attribute_custom18 =~ /\[(.*?)\]/g; } if ($custom18_user && ($custom18_user ne $guest_username)) { $old_custom18_email = $custom18_email; &read_user_emails($custom18_user); } # if ($custom18_user) { # open (USERDB, "$userdb"); # my (@USERCHECK)=
; # close (USERDB); # chomp @USERCHECK; # foreach my $row (@USERCHECK) { # my ($this_row_username,$ifuserpass,$ifuserid,$ifemail,$iffirstname,$iflastname,$this_row_group,$ifusername_display) = split(/\|/,$row); # if ($custom18_user eq $this_row_username && $this_row_group eq $ifgroup) { # $good_to_go = 1; # last; # } # } # } # if ($is_user && !$one_time_access && !$good_to_go) { if ($is_user && !$one_time_access && !$group_media_mod_per) { if (($custom18_user ne $ifusername) or ($confirmed_guest && !$FORM{'from_ul'})) { if (!$custom18_user) { $custom18_user = "server admin"; } &Error("Sorry $ifusername, you do not have permission to add captions to files from $custom18_user."); } } if ($admin_approve_image) { $createinfo->SetAttribute('custom18',"[$custom18_date][$custom18_user][$custom18_email][][$custom18_file_type]"); } elsif (!$custom18_date) { $createinfo->SetAttribute('custom18',"[$filedate][$custom18_user][$custom18_email][$custom18_approval][$custom18_file_type]"); } elsif ($old_custom18_email ne $custom18_email) { $createinfo->SetAttribute('custom18',"[$custom18_date][$custom18_user][$custom18_email][$custom18_approval][$custom18_file_type]"); } $createinfo->SetAttribute('originating program','www.imagefolio.com'); $createinfo->SetAttribute('program version','3.x'); $createinfo->Save() or &Error ("Could not save $image_directory/$category/$error_image. Reason: $!") unless $admin_demo_mode; } ############################################################################### # GET KEYFORM # We read through the image index, find a matching file then build a form # from which to add/modify keywords ############################################################################### sub get_keyform { require "$libpath/iptc.pl"; if ($FORM{'admin'} eq 'caption_confirm_image') { @sorted_admin_images = sort { if($a =~ /^$mypattern/i) { return -1; } elsif($b =~ /^$mypattern/i) { return 1; } else { return $a cmp $b; } } @admin_images; foreach $admin_image (@sorted_admin_images) { $admin_image =~ s/some_secret_code_17_/$mypattern_fullsize/ig; ($extension) = ($admin_image =~ /\.([^.]+)$/); if ((lc($extension) eq 'jpg') && !defined($iptc_info)) { $iptc_info = new Image::IPTCInfo("$image_directory/$admin_directory/$admin_image"); $found_iptc_image = 1; } } if (!$found_iptc_image) { &Error ("We could not find a valid IPTC image. Make sure that at least one of the files has a .jpg extension!"); } } else { $iptcthumbimage = $image; $iptcfullimage = $image; $iptcfullimage =~ s/$mypattern//ig; $iptc_info = new Image::IPTCInfo("$image_directory/$category/$iptcthumbimage"); unless (defined($iptc_info)){ if (-e "$image_directory/$category/$iptcfullimage") { $iptc_info = new Image::IPTCInfo("$image_directory/$category/$iptcfullimage"); } } } foreach $key (sort keys %IPTCfields) { $iptcvalue = ""; $iptcrule = ""; $rule = ""; $iptcbytes = $IPTCfields{$key}[0]; $iptcattribute = $IPTCfields{$key}[1]; next if $iptcattribute eq 'custom18'; $iptcfield = $IPTCfields{$key}[2]; $iptcrule = $IPTCfields{$key}[3]; $iptcattributeform = $iptcattribute; $iptcattributeform =~ s/\///g; $iptcattributeform =~ s/\s+//g; $iptcattributeform =~ s/\-//g; if ($iptcrule==1) { $rule = "Display"; } elsif ($iptcrule==2) { $rule = "Display + Search"; } elsif ($iptcrule==3) { $rule = "Search"; } else { $rule = "Edit only"; } foreach $iptc_thumbnails_field (@iptc_thumbnails_fields) { if ($iptc_thumbnails_field eq $iptcattribute) { $rule .= " + Thumb Display"; last; } } if ($bgcolored) { $bgcolor = "#FFFFFF"; $bgcolored = 0; } else { $bgcolor = "#DDDDDD"; $bgcolored = 1; } if ($iptcattribute eq 'keywords') { if (defined($iptc_info)){ $keywordsRef = $iptc_info->Keywords(); if (defined($keywordsRef)) { foreach $iptc_keyword (@$keywordsRef) { $iptcvalue .= "$iptc_keyword "; } } } $fieldvalue = $iptcvalue; $fieldlength = $iptcbytes - length($fieldvalue); $onkeyup = qq|val = this.value; if (val.length > $iptcbytes) {alert('According to the IPTC standard this field ($iptcfield) can not be longer then $iptcbytes characters.'); this.value = val.substring(0,$iptcbytes); $iptcattributeform.focus() }|; $boxsize = length($iptcbytes); $metadata .= qq|
<$admin_small_font>
$iptcfield
($rule)
$fieldvalue
|; } else { if (($iptcattribute =~ /custom/) && !$is_user) { $star = '
*
'; $star_note = 1; } elsif ($iptcattribute =~ /date/i) { if ($eu_date_format) { $star = ' dd/mm/yyyy'; } else { $star = ' mm/dd/yyyy'; } } else { $star = ''; } if (defined($iptc_info)){ $iptcvalue = $iptc_info->Attribute("$iptcattribute"); } $fieldvalue = $iptcvalue; if ($iptcattribute =~ /date/i && $fieldvalue =~ /\S+/) { @character = split(//, $fieldvalue); if ($eu_date_format) { $fieldvalue = qq|@character[6]@character[7]/@character[4]@character[5]/@character[0]@character[1]@character[2]@character[3]|; } else { $fieldvalue = qq|@character[4]@character[5]/@character[6]@character[7]/@character[0]@character[1]@character[2]@character[3]|; } } $fieldlength = $iptcbytes - length($fieldvalue); $onkeyup = qq|val = this.value; if (val.length > $iptcbytes) {alert('According to the IPTC standard this field ($iptcfield) can not be longer then $iptcbytes characters.'); this.value = val.substring(0,$iptcbytes); $iptcattributeform.focus() }|; $boxsize = length($iptcbytes); if ($iptcbytes > '128') { $metadata .= qq|
<$admin_small_font>
$iptcfield
$star
($rule)
$fieldvalue
|; } else{ $metadata .= qq|
<$admin_small_font>
$iptcfield
$star
($rule)
|; } } } $keyform .= qq|
$metadata
|; } ############################################################################### # GET IMAGELIST # We read the directory selected in step one and pull out all of the images # in the directory and create a selection form ############################################################################### sub get_imagelist { $totalnames = 0; if ($image eq $file) { $selected = " selected"; } else { $selected = ""; } opendir(IMAGEDIR,"$image_directory/$category") or &Error ("Could not read directory, $image_directory/$category. Reason: $!"); $imagelist .= qq|
|; @files = readdir(IMAGEDIR); @files = sort { lc($a) cmp lc($b) } @files; # sort the file names alphabetically @names = (); # declare the thumbnails array foreach $file (@files) { if ( -d "$image_directory/$category/$file" ) { # if this is a directory we aren't doing anything # do nothing } else{ if ( -B "$image_directory/$category/$file" && $file =~ /$mypattern/i && $file =~ /.jpg/i) { # if this is a thumbnail and binary file $newfile = $file; $newfile =~ s/$mypattern//g; # remove the pattern if ($image eq $file) { $selected = " selected"; } else { $selected = ""; } $file =~ s/([^a-zA-Z0-9$ignore_chars])/'%' . sprintf("%2x", ord($1))/ge; $imagelist .= qq|
$newfile|; # create our options for the select form $totalnames++; # count all of the thumnails found } } } closedir(IMAGEDIR); $imagelist .= qq|
|; unless ($totalnames >= 1) { &Error ("The category '$category' does not contain any images."); } } 1;
iptc_keywords.pl
Dirección de la página
Dirección del archivo
Anterior
19/27
Siguiente
Descargar
( 28 KB )
Comments
Total ratings:
0
Average rating:
No clasificado
of 10