The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mail::Builder::Image::File - Module for handling inline images from files

SYNOPSIS

  use Mail::Builder;
  
  my $image = new Mail::Builder::Image::File('/home/guybrush/invitation.gif');
  # Change CID
  $image->id('invitation_location');
  
  # Mail::Builder object
  $mb->image($image);
  OR
  $mb->image->add($image);
  
  # In the e-mail body
  <img src="cid:invitation_location" alt=""/>
  

DESCRIPTION

This is a simple module for handling inline images. The module needs the path to the file and optional an id which can be used to reference the file from within the e-mail text.

METHODS

Constructor

new

 Mail::Builder::Image::File->new(PATH[,REFERENCE ID]);

Simple constructor

Public Methods

serialize

Returns the image as a MIME::Entity object.

compare

 $obj->compare(OBJECT);
 or
 $obj->compare(PATH);

Checks if two image objects contain the same file. Returns true or false. The compare method does not check if the image id of the two objects are identical.

Instead of a Mail::Builder::Image object you can also pass a scalar value representing the image path .

Accessors

id

Accessor which takes/returns the id of the file. If no id is provided the lowercase filename without the extension will be used as the id.

The id is needed to reference the image in the e-mail body: <img src="cid:invitation_location" alt=""/>

path

Accessor which takes/returns the path of the file on the filesystem. The file must be readable. Only .jpeg, .jpg, .gif and .png files may be added.

AUTHOR

    Maroš Kollár
    CPAN ID: MAROS
    maros [at] k-1.com
    http://www.k-1.com