Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 08c77fe2

Von Werner Hahn vor mehr als 7 Jahren hinzugefügt

  • ID 08c77fe271eac6051d6ca795b155c19fa418ee4f
  • Vorgänger c267657f
  • Nachfolger de6a0946

Shopmodul: Aufräumarbeiten

Unterschiede anzeigen:

SL/Controller/Helper/ThumbnailCreator.pm
our @ISA = qw(Exporter);
our @EXPORT = qw(file_create_thumbnail file_update_thumbnail file_probe_type file_probe_image_type file_update_type_and_dimensions);
# TODO PDFs and others like odt,txt,...
our %supported_mime_types = (
'image/gif' => { extension => 'gif', convert_to_png => 1, },
'image/png' => { extension => 'png' },
......
sub file_create_thumbnail {
my ($thumb) = @_;
croak "No picture set yet" if !$thumb->{content};
$main::lxdebug->dump(0, 'WH: CTHUMB ', $thumb);
my $image = GD::Image->new($thumb->{content});
my ($width, $height) = $image->getBounds;
my $max_dim = 64;
......
$thumb->{thumbnail_img_content_type} = "image/png";
$thumb->{thumbnail_img_width} = $new_width;
$thumb->{thumbnail_img_height} = $new_height;
#$self->thumbnail_img_content($thumbnail->png);
#$self->thumbnail_img_content_type('image/png');
#$self->thumbnail_img_width($new_width);
#$self->thumbnail_img_height($new_height);
return $thumb;
}
......
sub file_probe_type {
my ($content) = @_;
#$main::lxdebug->dump(0, 'WH: FPT Content', $content);
return (t8("No file uploaded yet")) if !$content;
#my $mime_type = File::MimeInfo::Magic::magic($content);
#$main::lxdebug->dump(0, 'WH: MIME ', $mime_type);
my $info = Image::Info::image_info(\$content);
#$main::lxdebug->dump(0, 'WH: INFO', $info);
if (!$info || $info->{error} || !$info->{file_media_type} || !$supported_mime_types{ $info->{file_media_type} }) {
$::lxdebug->warn("Image::Info error: " . $info->{error}) if $info && $info->{error};
return (t8('Unsupported image type (supported types: #1)', join(' ', sort keys %supported_mime_types)));
......
$thumbnail->{file_image_width} = $info->{width};
$thumbnail->{file_image_height} = $info->{height};
$thumbnail->{content} = $content;
#$self->file_content_type($info->{file_media_type});
#$self->files_img_width($info->{width});
#$self->files_img_height($info->{height});
#$self->files_mtime(DateTime->now_local);
$thumbnail = &file_create_thumbnail($thumbnail);
SL/Controller/ShopPart.pm
sub action_show_files {
my ($self) = @_;
$main::lxdebug->message(0, "WH:ShowFiles ");
$main::lxdebug->dump(0, 'WH:FORM ',$::form);
$main::lxdebug->dump(0, 'WH:FORM ',$::form->{part});
#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' );
#my $images = SL::DB::Manager::ShopImage->get_all_sorted( where => [ partnumber => $::form->{part}{partnumber}, ], with_object => 'file', sort_by => 'position' );
my $images = SL::DB::Manager::ShopImage->get_all( where => [ 'files.object_id' => $::form->{id}, ], with_objects => 'file', sort_by => 'position' );
$main::lxdebug->dump(0, 'WH:ShowFiles1 ',$images);
$self->render('shop_part/_list_images', { header => 0 }, IMAGES => $images);
}
SL/File.pm
sub _save {
my ($self, %params) = @_;
$main::lxdebug->dump(0, 'WH: PARAMS', \%params);
my $file = $params{dbfile};
my $exists = 0;
......
if($file->object_type eq "shop_image"){
my $image_content = $params{file_contents};
my $thumbnail = file_probe_type($image_content);
$main::lxdebug->dump(0, 'WH: THUMB ',$thumbnail);
my $shopimage = SL::DB::ShopImage->new();
$shopimage->assign_attributes(
file_id => $file->id,
SL/IS.pm
sub _determine_wh_and_bin {
$::lxdebug->enter_sub(2);
# DF funktioniert so ist aber nicht gut
if (@_ == 6) {my $dummy = shift;}
my ($dbh, $conf, $part_id, $qty, $unit) = @_;
my @errors;
bin/mozilla/ic.pl
#TMP
#=====================================================================
# LX-Office ERP
# Copyright (C) 2004

Auch abrufbar als: Unified diff