Mail::Builder::Image - Helper module for handling inline images


NAME

Mail::Builder::Image - Helper module for handling inline images


SYNOPSIS

  use Mail::Builder;
  
  my $image = Mail::Builder::Image('/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=""/>
  
  =head1 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->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

 Mail::Builder::Image - Helper module for handling inline images