Cool.
Alors dans le fichier
ImageList.pm, à la suite de
# this class implements a collection of image files with associated data
$|=1;
__PACKAGE__->mk_accessors(
qw/
thumb_size
preview_ratio
categories
...
imagelist_version
Ajoute
watermark_active
watermark_text
watermark_text_size
watermark_position
watermark_marge_y
watermark_marge_x
watermark_color
watermark_active_pwg_high
Après la fonction CreateResized
sub CreateWatermark {
my ( $self, $text, $text_size, $position, $x, $y, $color, $file_out ) = @_;
my $rval = 1 ;
my $gravity = '';
my $fill = '';
# debug
printf("Create watermark %s\n", $file_out);
if($position eq gettext("Top left")) {
$gravity = 'NorthWest';
}
if($position eq gettext("Top right")) {
$gravity = 'NorthEast';
}
if($position eq gettext("Bottom left")) {
$gravity = 'SouthWest';
}
if($position eq gettext("Bottom right")) {
$gravity = 'SouthEast';
}
if($color eq gettext("White")) {
$fill = '#FFFFFF';
}
if($color eq gettext("Black")) {
$fill = '#000000';
}
my $image = new Image::Magick;
my $status = $image->ReadImage(
encode('iso-8859-1', $file_out)
);
$image->Annotate(
font => 'kai.ttf',
pointsize => $text_size,
fill => $fill,
x => $x,
y => $y,
text => $text,
gravity => $gravity,
);
$image->Write(
sprintf(
"%s:%s",
$self->type,
encode('iso-8859-1', $file_out),
)
);
}
Vers la ligne 837, à la suite de
sub Store {
my ( $self ) = @_;
my $data = $self->get_storable(
[
qw/
images
thumb_size
preview_ratio
type
...
imagelist_version
Ajoute
watermark_active
watermark_text
watermark_text_size
watermark_position
watermark_marge_y
watermark_marge_x
watermark_color
watermark_active_pwg_high
Vers la ligne 988 dans la fonction UploadSelection après
if( $self->watermark_active ) {
my $file_out = $self->current_image->site_resized_file;
$self->CreateWatermark(
$self->watermark_text,
$self->watermark_text_size,
$self->watermark_position,
$self->watermark_marge_x,
$self->watermark_marge_y,
$self->watermark_color,
$file_out
);
}
Vers la ligne 1008 dans la fonction UploadSelection après
# the original is at the right size, no need to create a resize
else {
$self->current_image->site_resized_file(
$self->current_image->file,
);
Ajoute
if( $self->watermark_active ) {
my $file_out = $self->current_image->site_resized_file;
$self->CreateWatermark(
$self->watermark_text,
$self->watermark_text_size,
$self->watermark_position,
$self->watermark_marge_x,
$self->watermark_marge_y,
$self->watermark_color,
$file_out
);
}
Dans la fonction CreateHigh il faut ajouter
if( $self->watermark_active_pwg_high ) {
my $file_out = $self->current_image->site_high_file;
$self->CreateWatermark(
$self->watermark_text,
$self->watermark_text_size,
$self->watermark_position,
$self->watermark_marge_x,
$self->watermark_marge_y,
$self->watermark_color,
$file_out
);
}
C'est le bout qui ne prend pas la bonne photo.
Dans le fichier
wsApp.pm, dans _default_imagelist_params après
my $params = {
new_files => [],
thumb_size => 120,
...
ResizeCallback => sub { $self->ResizeImage(@_) },
Ajoute
watermark_active => 0,
watermark_text => '',
watermark_text_size => 10,
watermark_position => gettext('Top left'),
watermark_marge_y => 10,
watermark_marge_x => 10,
watermark_color => gettext('White'),
watermark_active_pwg_high => 0,
Dans le fichier
wxFrameAUI.pm vers la ligne 337 dans
my @properties =
qw/
progressdlg
upload_progressdlg
imageviewer
..
preview_settings
advanced_settings
Ajoute
watermark_settings
Vers la ligne 713 après
$self->advanced_settings(
[
{
label => gettext("Transfert chunk size :"),
type => 'Number',
value => sub { wxTheApp->chunk_size(@_) },
},
]
);
Ajoute
$self->watermark_settings(
[
{
label => gettext("Active watermark :"),
type => 'Bool',
value => sub { $self->imagelist->watermark_active(@_) },
},
{
label => gettext("Active watermark on high definition :"),
type => 'Bool',
value => sub { $self->imagelist->watermark_active_pwg_high(@_) },
},
{
label => gettext("Watermark text :"),
value => sub { $self->imagelist->watermark_text(@_) },
},
{
label => gettext("Watermark text size :"),
type => 'Number',
value => sub { $self->imagelist->watermark_text_size(@_) },
},
{
label => gettext("Watermark color :"),
type => 'Choice',
value => sub { $self->imagelist->watermark_color(@_) },
choice => [
gettext("White"),
gettext("Black"),
],
},
{
label => gettext("Watermark position :"),
type => 'Choice',
value => sub { $self->imagelist->watermark_position(@_) },
choice => [
gettext("Top left"),
gettext("Top right"),
gettext("Bottom left"),
gettext("Bottom right"),
],
},
{
label => gettext("Watermark marge y :"),
type => 'Number',
value => sub { $self->imagelist->watermark_marge_y(@_) },
},
{
label => gettext("Watermark marge x :"),
type => 'Number',
value => sub { $self->imagelist->watermark_marge_x(@_) },
},
]
);
Vers la ligne 804 dans la fonction _refreshFrame après
$self->advanced_settings_panel,
Ajoute
$self->watermark_settings_panel,
Vers la ligne 867 dans la fonction _refresh_settings_panels_properties après
$self->advanced_settings_panel->properties(
$self->advanced_settings,
);
Ajoute
$self->watermark_settings_panel->properties(
$self->watermark_settings,
);
Vers la ligne 905 dans la fonction _init_settings_panels après
$self->advanced_settings_panel(
Uploader::GUI::wxPropertyGridPanel->new(
{
parentwnd => $self,
properties => $self->advanced_settings,
frame_callbacks => [],
}
)
);
Ajoute
$self->watermark_settings_panel(
Uploader::GUI::wxPropertyGridPanel->new(
{
parentwnd => $self,
properties => $self->watermark_settings,
frame_callbacks => [],
}
)
);
Vers la ligne 1275 dans la fonction create_notebook_global_settings après
[
$self->advanced_settings_panel,
gettext("Advanced"),
],
Ajoute
[
$self->watermark_settings_panel,
gettext("Watermark"),
],
Voila il me semble avoir fait le tour.