Revision 171

Date:
2012/01/18 19:14:14
Author:
ahitrov
Revision Log:
The more comprehensive method for image upload
Files:

Legend:

 
Added
 
Removed
 
Modified
  • koi8/core/comps/contenido/components/set_image.msn

     
    29 29 }
    30 30 if ($upload) {
    31 31
    32 my $IMG = $object->_store_image( $upload, attr => $prop->{attr} );
    32 my $IMG = $object->_store_image( $upload, attr => $prop->{attr}, prop => $prop );
    33 33
    34 34 if ( ref $IMG eq 'HASH' && exists $IMG->{filename} ) {
    35 35 $object->_delete_image( $default );
  • koi8/core/lib/Contenido/File.pm

     
    171 171 my $input = shift;
    172 172 my (%opts) = @_;
    173 173 my $object = delete $opts{object} || return;
    174 my $attr = delete $opts{attr} || return;
    174 my $attr = delete $opts{attr};
    175 175
    176 my ($prop) = grep { $_->{attr} eq $attr } $object->structure;
    176 my ($prop) = exists $opts{prop} && ref $opts{prop} ? ($opts{prop}) : $attr ? grep { $_->{attr} eq $attr } $object->structure : (undef);
    177 177 return unless ref $prop;
    178 178 my @preview = exists $prop->{'preview'} && ref $prop->{'preview'} eq 'ARRAY' ? @{$prop->{'preview'}} : exists $prop->{'preview'} && $prop->{'preview'} ? ($prop->{'preview'}) : ();
    179 179 my @crops = exists $prop->{'crop'} && ref $prop->{'crop'} eq 'ARRAY' ? @{$prop->{'crop'}} : exists $prop->{'crop'} && $prop->{'crop'} ? ($prop->{'crop'}) : ();
  • koi8/core/lib/Contenido/File/Scheme/HTTP.pm

     
    12 12 use LWP::UserAgent;
    13 13 use File::Temp;
    14 14
    15 my %LWP_ARGS = (timeout => 5);
    15 my %LWP_ARGS = (timeout => 10);
    16 16
    17 17 sub fetch {
    18 18 my $path = shift || return;
  • koi8/core/lib/Contenido/Object.pm

     
    1144 1144 my $input = shift;
    1145 1145 my (%opts) = @_;
    1146 1146
    1147 return Contenido::File::store_image( $input, object => $self, attr => $opts{attr} );
    1147 return Contenido::File::store_image( $input, object => $self, attr => $opts{attr}, prop => $opts{prop} );
    1148 1148 }
    1149 1149
    1150 1150 # ----------------------------------------------------------------------------