Perl 5.14 - Win32 XP
#!/usr/bin/perl
use Carp;
use strict;
use warnings;
use 5.010_000;
use ODF::lpOD;
use Cwd;
my $doc = odf_document->create('text');
my $contexte = $doc->get_body;
my $src =
'
http://upload.wikimedia.org/wikipedia/commons/6/63/Wikipedia-logo.png';
my $image = $doc->add_file(
$src,
path => 'Pictures/Wikipedia-logo.png',
type => 'image/png',
);
my $size_image_pt = image_size($src);
if ( not defined $size_image_pt ) {
say "image_size return undef, test add_image_file method";
my ( $path, $image_size ) = $doc->add_image_file($src);
if ( not defined $path ) { say "\t\$path not defined"; }
elsif ( not defined $image_size ) { say "\t\$image_size not defined"; }
else {
say "NNNNNNNNNNNN \$path : $path\n \$image_size : $image_size";
$size_image_pt = $image_size;
}
}
say "\$image : $image";
say "\$src : $src";
my $frame = odf_frame->create(
image => $image,
size => $size_image_pt,
description => 'description',
title => 'title',
);
my $paragraphe_vide = $contexte->append_element( odf_create_paragraph()
)->append_element($frame);
$doc->save(target => "AddFile.odt");
exit;
__END__
Result :
=============================
image_size return undef, test add_image_file method
$image_size not defined
$image : Pictures/Wikipedia-logo.png
$src :
http://upload.wikimedia.org/wikipedia/commons/6/63/Wikipedia-logo.png
read_file 'Pictures/Wikipedia-logo.png' - sysopen: No such file or
directory at C:/Perl/site/lib/ODF/lpOD/Common.pm line 731
=============================
Le Mar 14 Fév 2012 15:19:21, JMGDOC a écrit :
Show quoted text> OK, the issue comes from a change in the file path interpretation in
> the last
> version of image_size().
>
> This function has been improved in order to be able to calculate the
> size of
> remote images (i.e.
http://path...) as well as local ones. Due to this
> change,
> the path is apparently sometimes misinterpreted in a Windows file
> system.
> I take the bug and I will fix it fir the next release.
>
> In the mean time, I suggest you to use 1.117. But, just in order to
> help me to
> lock the issue, could you execute a last test with a remote image
> (anywhere in
> the web), such as in the code below, and tell me if it works on Win32:
>
> ($path, $size) =
>
add_image_file('
http://upload.wikimedia.org/wikipedia/commons/6/63/Wikipedia-
Show quoted text> logo.png')
>
>
> On 2012-02-14 08:05:52, DJIBELwrote :
> > Hum !!
> > The problem was the size of Frame, but the real problem was
> image_size
> > method.
> >
> > In fact, I use this code :
> > my $size_image_pt = image_size($image);
> > my $frame = odf_frame->create(
> > image => 'Pictures/image.png',
> > size => $size_image_pt,
> > description => 'description',
> > title => 'title',
> > );
> >
> > Since ODF::lpOD 1.118, for some images, $size_image_pt is undef. If
> I use
> >
> > my ( $path, $size ) = $doc->add_image_file($src);
> >
> > $size is undef too.
> >
> > Then, I have the sysopen error message.
> >
> > If I use ODF::lpOD 1.117, no problem.
> >
> >