NAME

WordPress::API::MediaObject

SYNOPSIS

use WordPress::API::MediaObject;

my $o = WordPress::API::MediaObject->new({ proxy => 'http://site.com/xmlrpc.php', username => 'tito', password => 'yup', });

$o->load_file('/path/to/media/file.jpg');

$o->upload;

$o->url;

METHODS

new()

arg is hash ref, keys are proxy, username, password you can also pass server insetead, which is an XMLRPC::Simple object

load_file()

optional argument is abs path to media file returns boolean this is what encodes your file to bits, set the meme type, etc if no argument is passed, abs_path() must have been set

bits()

returns the bits if you called load_file()

type()

returns mime type if you called load_file()

name()

returns filename if you called load_file()

abs_path()

returns the abs path of the media file

abs_path_resolve()

makes sure file is on disk

structure_data()

returns struct that will be sent to wordpress via xmlrpc, see WordPress::Base::Data::Object

upload(), save()

uploads the data returns url

url()

will return url via which object can be reached via http call after upload()

SEE ALSO

WordPress::XMLRPC

AUTHOR

Leo Charre leocharre at cpan for org