Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 31378f48

Von Werner Hahn vor mehr als 7 Jahren hinzugefügt

  • ID 31378f48eb1742809789dd2e9670f8564850cce1
  • Vorgänger 1228b36f
  • Nachfolger 255d89a0

WebshopApi: Bilder hochladen

Unterschiede anzeigen:

SL/File.pm
8 8
use SL::File::Backend;
9 9
use SL::File::Object;
10 10
use SL::DB::History;
11
use SL::DB::ShopImage;
11 12
use SL::DB::File;
12 13
use SL::Helper::UserPreferences;
14
use SL::Controller::Helper::ThumbnailCreator qw(file_probe_type);
13 15
use SL::JSON;
14 16

  
15 17
use constant RENAME_OK          => 0;
......
240 242

  
241 243
  $file->mtime(DateTime->now_local);
242 244
  $file->save;
245
  #ShopImage
246
  if($file->object_type eq "shop_image"){
247
    my $image_content = $params{file_contents};
248
    my $thumbnail = file_probe_type($image_content);
249
    my $shopimage = SL::DB::ShopImage->new();
250
    $shopimage->assign_attributes(
251
                                  file_id                => $file->id,
252
                                  thumbnail_content      => $thumbnail->{thumbnail_img_content},
253
                                  org_file_height        => $thumbnail->{file_image_height},
254
                                  org_file_width         => $thumbnail->{file_image_width},
255
                                  thumbnail_content_type => $thumbnail->{thumbnail_img_content_type},
256
                                  object_id              => $file->object_id,
257
                                 );
258
    $shopimage->save;
259
  }
243 260
  if ($params{file_type} eq 'document' && $params{source} ne 'created') {
244 261
    SL::DB::History->new(
245 262
      addition    => 'IMPORT',

Auch abrufbar als: Unified diff