Revision 365

Date:
2013/06/18 17:21:08
Author:
ahitrov
Revision Log:
Watermark incapsulation
Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/core/GNUmakefile

     
    1153 1153 CASCADE \
    1154 1154 COMP_CACHE_ENABLED \
    1155 1155 COMP_TIMINGS_DISABLE \
    1156 COMPOSITE \
    1156 1157 CONF \
    1157 1158 CONTENIDO_VERSION \
    1158 1159 CONVERT \
  • utf8/core/lib/Contenido/File.pm

     
    278 278 unlink $filename_tmp.'.shaved.'.$ext if -e $filename_tmp.'.shaved.'.$ext;
    279 279 }
    280 280
    281 if ( exists $opts{watermark} && $opts{watermark} ) {
    282 my $gravity = delete $opts{gravity} || 'Center';
    283 my $source = $transformed ? $filename_tmp.'.transformed.'.$ext : $filename_tmp.'.'.$ext;
    284 my $target = $filename_tmp.'.transformed.'.$ext;
    285 my $offset = delete $opts{offset} || '+0+0';
    286 my $c_line = $state->{'composite_binary'}." -geometry $offset -gravity $gravity -quality 99 $opts{watermark} $source $target";
    287 warn "Watermark: $c_line\n" if $DEBUG;
    288 my $result = `$c_line`;
    289 $transformed = 1;
    290 }
    291
    281 292 my $IMAGE;
    282 293 my $stored = $transformed ? store($filename.'.'.$ext, $filename_tmp.'.transformed.'.$ext) : store($filename.'.'.$ext, $filename_tmp.'.'.$ext);
    283 294 if ( $stored ) {
  • utf8/core/lib/Contenido/Object.pm

     
    1192 1192 #
    1193 1193 # Формат использования:
    1194 1194 # $document->_store_image( INPUT, attr => 'fieldname' )
    1195 # $document->_store_image( INPUT, prop => $prophash )
    1195 1196 # ----------------------------------------------------------------------------
    1196 1197 sub _store_image {
    1197 1198 my $self = shift;
     
    1200 1201 my $input = shift;
    1201 1202 my (%opts) = @_;
    1202 1203
    1203 return Contenido::File::store_image( $input, object => $self, attr => $opts{attr}, prop => $opts{prop} );
    1204 return Contenido::File::store_image( $input, object => $self, %opts );
    1204 1205 }
    1205 1206
    1206 1207 # ----------------------------------------------------------------------------
  • utf8/core/lib/Contenido/State.pm.proto

     
    79 79 $self->{files_dir} = [split /\s+/ms, $files_dir];
    80 80 }
    81 81
    82 $self->{composite_binary} = '@COMPOSITE@';
    82 83 $self->{convert_binary} = '@CONVERT@';
    83 84 $self->{file_web_storage} = lc('@FILE_WEB_STORAGE@');
    84 85
  • utf8/core/project-default.mk

     
    206 206 echo 'exit 1;'; \
    207 207 fi;}
    208 208
    209 COMPOSITE = ${shell export PATH=${LOCAL}/bin:$${PATH}; which composite}
    209 210 CONVERT = ${shell export PATH=${LOCAL}/bin:$${PATH}; which convert}
    210 211 ifeq (${CONVERT},)
    211 212 ${error ERROR: No executable convert found, you need to install ImageMagick first}