Cláudio Valente > Image-ImageShack > Image::ImageShack

Download:
Image-ImageShack-0.04.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 0.04   Source  

NAME ^

Image::ImageShack - Upload images to be hosted at imageshack.us without needing any account information.

SYNOPSIS ^

  require Image::ImageShack;

  my $ishack = Image::ImageShack->new();

  #you can access the LWP::UserAgent via the user_agent method
  #proxy can be specified by
  $ishack->user_agent->proxy(['http'], 'http://localhost:8080/');

  my $image_url = 'http://www.domain.com/image.png';
  
  #upload specifying a url
  my $url1 = $ishack->host($image_url); #upload with real size, just optimizes
  my $url2 = $ishack->host($image_url, 320);    #resize to 320x240 (for websites and email)

  #upload a file
  my $url3 = $ishack->host('image.jpg');        #upload file

  #get the thumbnail address
  my $thumb_url = $ishack->thumb_url();

  #will croak on error

DESCRIPTION ^

Image::ImageShack intends to make programmatically possible to upload image files to the website http://imageshack.us/.

imageshack.us allows you to upload image files (jpg, jpeg, png, gif, bmp, tif, tiff, swf < 1.5 megabytes) and to optimize and or resize these files while making them available to others via imageshack.us servers (even direct linking).

A thumbnail is always created.

Method Summary

new(attr=>value)

Constructor. Initializes the object.

Attributes are:

agent

LWP::UserAgent object to used make HTTP requests

bar

Boolean indicating whether thumbnails should have a black bar at the bottom with real image size

login

Id used to upload the files. If you have registered with imageshack.us, you should have received an email with a link similar to: http://reg.imageshack.us/setlogin.php?login=SOME_IDENTIFIER

If you intend to be able to later on use the web interface to erase files, you should pass either that link as the login parameter or only the user_id (SOME_IDENTIFIER).

No verification on the validity of the user_id is currently made

user_agent

Returns or sets the LWP::UserAgent object used internally so that it can the customised

host($url, $size)

Given an url (starts with http:// or https://) or a filename and a width in pixels uploads the image to image imageshack.us and resizes it to the desired size. Returns the url of the hosted image and croaks on error.

Possible values for $size are:

100

100 x 75 (avatar)

150

150x112 (thumbnail)

320

320 x 240 ( for websites and email )

640

640x480 (for message boards)

800

800 x 600 ( 15 -inch monitor )

1024

1024x768 (17-inch monitor)

1280

1280 x 1024 ( 19 -inch monitor )

1600

1600x1200 (21-inch monitor)

resample

just optimizes

hosted

Returns the url of the last uploaded image.

hosted_thumb

Returns the url of the thumbnail last uploaded image. Could be non existent for small images.

login

Returns or sets the user_id.

logout

Resets user_id. From now on images won't be associated with any user.

DISCLAIMER ^

The author declines ANY responsibility for possible infringement of ImageShack® Terms of Service.

This module doesn't use imageshack's XML API but the HTML/web interface instead.

TO-DO ^

No guarantee that this will ever be implemented

HTML code for forums, thumbnails, websites, etc (if you really need this, please ask the author)

File deletin

Implement XML API (probably never or on a different)

SEE ALSO ^

LWP::UserAgent

http://imageshack.us

http://reg.imageshack.us/content.php?page=faq

http://reg.imageshack.us/content.php?page=rules

AUTHOR ^

Cláudio Valente, <plank@cpan.org>

COPYRIGHT AND LICENSE ^

Copyright (C) 2009 by Cláudio Valente

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.