Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 1050369d

Von Werner Hahn vor mehr als 7 Jahren hinzugefügt

  • ID 1050369d60a9ad46bd09d4675f8b889f40358a13
  • Vorgänger ed8a2661
  • Nachfolger 38dbb246

Shopmodul: Aufräumarbeiten

Unterschiede anzeigen:

SL/Controller/Helper/ThumbnailCreator.pm
15 15
our @ISA      = qw(Exporter);
16 16
our @EXPORT   = qw(file_create_thumbnail file_update_thumbnail file_probe_type file_probe_image_type file_update_type_and_dimensions);
17 17

  
18
# TODO PDFs and others like odt,txt,...
19 18
our %supported_mime_types = (
20 19
  'image/gif'  => { extension => 'gif', convert_to_png => 1, },
21 20
  'image/png'  => { extension => 'png' },
......
26 25
sub file_create_thumbnail {
27 26
  my ($thumb) = @_;
28 27
  croak "No picture set yet" if !$thumb->{content};
29
$main::lxdebug->dump(0, 'WH: CTHUMB ', $thumb);
30 28
  my $image            = GD::Image->new($thumb->{content});
31 29
  my ($width, $height) = $image->getBounds;
32 30
  my $max_dim          = 64;
......
42 40
  $thumb->{thumbnail_img_content_type} = "image/png";
43 41
  $thumb->{thumbnail_img_width} = $new_width;
44 42
  $thumb->{thumbnail_img_height} = $new_height;
45
  #$self->thumbnail_img_content($thumbnail->png);
46
  #$self->thumbnail_img_content_type('image/png');
47
  #$self->thumbnail_img_width($new_width);
48
  #$self->thumbnail_img_height($new_height);
49 43
  return $thumb;
50 44

  
51 45
}
......
71 65

  
72 66
sub file_probe_type {
73 67
  my ($content) = @_;
74
  #$main::lxdebug->dump(0, 'WH: FPT Content', $content);
75 68
  return (t8("No file uploaded yet")) if !$content;
76
  #my $mime_type = File::MimeInfo::Magic::magic($content);
77
  #$main::lxdebug->dump(0, 'WH: MIME ', $mime_type);
78 69
  my $info = Image::Info::image_info(\$content);
79
  #$main::lxdebug->dump(0, 'WH: INFO', $info);
80 70
  if (!$info || $info->{error} || !$info->{file_media_type} || !$supported_mime_types{ $info->{file_media_type} }) {
81 71
    $::lxdebug->warn("Image::Info error: " . $info->{error}) if $info && $info->{error};
82 72
    return (t8('Unsupported image type (supported types: #1)', join(' ', sort keys %supported_mime_types)));
......
87 77
  $thumbnail->{file_image_width} = $info->{width};
88 78
  $thumbnail->{file_image_height} = $info->{height};
89 79
  $thumbnail->{content} = $content;
90
  #$self->file_content_type($info->{file_media_type});
91
  #$self->files_img_width($info->{width});
92
  #$self->files_img_height($info->{height});
93
  #$self->files_mtime(DateTime->now_local);
94 80

  
95 81
  $thumbnail = &file_create_thumbnail($thumbnail);
96 82

  
SL/Controller/ShopPart.pm
66 66

  
67 67
sub action_show_files {
68 68
  my ($self) = @_;
69
$main::lxdebug->message(0, "WH:ShowFiles ");
70
$main::lxdebug->dump(0, 'WH:FORM ',$::form);
71
$main::lxdebug->dump(0, 'WH:FORM ',$::form->{part});
72 69

  
73
  #my $images = SL::DB::Manager::File->get_all_sorted( where => [ trans_id => $::form->{id}, modul => $::form->{modul}, file_content_type => { like => 'image/%' } ], sort_by => 'position' );
74
  #my $images = SL::DB::Manager::ShopImage->get_all_sorted( where => [ partnumber => $::form->{part}{partnumber}, ], with_object => 'file', sort_by => 'position' );
75 70
  my $images = SL::DB::Manager::ShopImage->get_all( where => [ 'files.object_id' => $::form->{id}, ], with_objects => 'file', sort_by => 'position' );
76
$main::lxdebug->dump(0, 'WH:ShowFiles1 ',$images);
77 71

  
78 72
  $self->render('shop_part/_list_images', { header => 0 }, IMAGES => $images);
79 73
}
SL/File.pm
191 191

  
192 192
sub _save {
193 193
  my ($self, %params) = @_;
194
  $main::lxdebug->dump(0, 'WH: PARAMS', \%params);
195 194
  my $file = $params{dbfile};
196 195
  my $exists = 0;
197 196

  
......
247 246
  if($file->object_type eq "shop_image"){
248 247
    my $image_content = $params{file_contents};
249 248
    my $thumbnail = file_probe_type($image_content);
250
    $main::lxdebug->dump(0, 'WH: THUMB ',$thumbnail);
251 249
    my $shopimage = SL::DB::ShopImage->new();
252 250
    $shopimage->assign_attributes(
253 251
                                  file_id                => $file->id,
SL/IS.pm
1480 1480

  
1481 1481
sub _determine_wh_and_bin {
1482 1482
  $::lxdebug->enter_sub(2);
1483
  # DF funktioniert so ist aber nicht gut
1484
  if (@_ == 6) {my $dummy = shift;}
1485 1483

  
1486 1484
  my ($dbh, $conf, $part_id, $qty, $unit) = @_;
1487 1485
  my @errors;
bin/mozilla/ic.pl
1
#TMP
2 1
#=====================================================================
3 2
# LX-Office ERP
4 3
# Copyright (C) 2004

Auch abrufbar als: Unified diff