208
208
should be imported from an external file and, implicitly, that the
209
209
image link (which it is useless to give here) points to the image
210
210
imported into the OpenOffice.org file. The import will only be made
211
when all the updates are validated by a save(). See importImage
211
when all the updates are validated by a save(). See importImage()
212
212
about importing images. An imported image is *not* embedded in the
213
213
XML image element; it's always referred to through a link, and stored
214
214
in a separate, non-XML member of the ODF archive. However, with the
491
491
Allows you to read or modify the display size of an image. Returns
492
492
the height and width as a pair of values. If height and width
493
arguments are provided, they replace the image's old size. Caution:
494
it is up to the application to maintain the proportions of an image
497
See imagePosition about measure formats.
493
arguments are provided, they replace the image's old size.
495
Note that this method deals with the display size only, and ignores
496
the original size of the image; in other words, it doesn't change
497
anything in the graphic object itself.
499
Caution: it is up to the application to maintain the aspect ratio of
502
See the "size" option about the createImageElement() method.
504
See imagePosition() about measure formats.
499
506
=head3 imageStyle(image [, style])
512
519
$doc->importImage("Image1", "C:\Images\Portrait.jpg");
514
This import cancels and replaces any previous image content.
521
This import cancels and replaces any previous image content, if any.
516
523
The first argument is either the image's name (as the user would see
517
524
it) or the image's corresponding element reference. In any case, the
518
image must already exist, created if necessary using
519
insertImageElement. Obviously, the imported file should preferably
520
be in a graphics format supported by OpenOffice.org, but this method
521
actually allows you to import anything, including data which could
522
not be displayed in an OpenOffice.org document.
525
image element must already exist, created if necessary using
526
insertImageElement().
528
The second argument is the full path of the image file to be
529
imported and associated to the ODF image object. If this argument is
530
omitted, importImage() assumes that the full path of the needed
531
resource file is indicated by an external link already associated
532
with the image object in the document (see imageLink).
534
Obviously, the imported file should preferably be in a graphic format
535
supported by most office software products, but this method actually
536
allows you to import anything, including data which could not be
524
539
Caution: this method does not carry out the import immediately and
525
540
does not check for the presence of the file to be imported. It only
526
541
sends the request to the associated OODoc::File object (via its
527
raw_import method) which performs the operation at the next save
542
raw_import method) which performs the operation at the next save()
543
call. As a consequence, the image file is needed later, but its
544
availability is not required by the importImage() method itself.
530
546
=head3 insertImageElement(name [, options])
548
564
=head3 selectImageElementByDescription(expression)
550
566
Returns the first (or only) image (if found) which has an image
551
description and which matches the regular expression.
567
description matching the provided regular expression.
569
See also selectImageElementsByDescription().
553
571
=head3 selectImageElementByLink(link)
569
587
Note: if an application needs to get a list of individual or
570
588
multiple images which share the same target, the easiest way is to
571
loop through the list returned by getImageElementList and perform an
572
imageLink on each element.
589
loop through the list returned by getImageElementList() and perform an
590
imageLink() on each element.
592
See also selectImageElementsByLink().
574
594
=head3 selectImageElementsByDescription(expression)
590
610
my @webimages = $doc->selectImageElementsByLink("^http:");
592
allows you to get a list of images which will not be visible if the
593
user's machine is not connected to the internet.
612
allows you to get a list of images referred to through an HTTP URL
613
(i.e. which will not be visible if the user's machine is not connected
595
616
=head3 selectImageElementsByName(expression)
621
642
Contact: jmgdoc@cpan.org
623
Copyright 2004-2006 by Genicorp, S.A. L<http://www.genicorp.com>
644
Copyright 2004-2009 by Genicorp, S.A. L<http://www.genicorp.com>
625
646
Initial English version of the reference manual by Graeme A. Hunter
626
647
(graeme.hunter@zen.co.uk).