Apache-Image

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

use warnings;
use Module::Build;

my $builder = Module::Build->new(
    module_name         => 'Apache::Image',
    license             => 'perl',
    dist_author         => 'Scott Penrose <scottp@dd.com.au>',
    dist_version_from   => 'lib/Apache/Image.pm',
    requires => {
        'Test::More' => 0,
	'Image::Magick' => 0,
	'Apache2::TrapSubRequest' => 0,

        # 'version'    => 0,
	# Image::Thumbnail - probably... XXX
    },
    add_to_cleanup      => [ 'Apache-Image-*' ],
);

$builder->create_build_script();

META.yml  view on Meta::CPAN

name: Apache-Image
version: v0.0.4
author:
  - 'Scott Penrose <scottp@dd.com.au>'
abstract: 'Generate a new image size, e.g. Thumbnail on the fly of any image, even dynamically generated (EXPERIMENTAL RELEASE)'
license: perl
resources:
  license: http://dev.perl.org/licenses/
requires:
  Apache2::TrapSubRequest: 0
  Image::Magick: 0
  Test::More: 0
provides:
  Apache::Image:
    file: lib/Apache/Image.pm
    version: !perl/version
      qv: 1
      version:
        - 0
        - 0
        - 4

lib/Apache/Image.pm  view on Meta::CPAN

use Apache2::Const -compile => qw(OK NOT_FOUND HTTP_MOVED_TEMPORARILY);
use Apache2::TrapSubRequest;

# XXX - Bug with getting uri/path_info
# 	If /z/image exists it works
# 	If /z/image does not, it is all broken
# 	If /z/image/thubnail exists it drops the first part of path info !
# 	all bad

# XXX We should use Image::Thumbnail !!!
use Image::Magick;

use Carp;
use version; our $VERSION = qv('0.0.4');

# TODO Can this be made to be Apaceh 1.3 (mod_perl 1) ? If not document the reason

sub handler {
	my $r = shift;

	# URI (original) & Configuration

lib/Apache/Image.pm  view on Meta::CPAN

		# TODO Future - Support creation of Thumbnails from other sources
                return Apache2::Const::OK;
        }

	# XXX Caching - Write entries to a directory and use internal redirect
	# to get them - only problem may be that a tif wants to be a jpg
	# thumbnail
	# $r->internal_redirect("/unknown.jpg");

        # Process the image into a thumbnail and output
        my $im = Image::Magick->new;
        $im->BlobToImage($image);

	# Resize if Force or Too big !
	if ($Force || ($im->Get('width') > $MaxSize) || ($im->Get('height') > $MaxSize)) {
		$im->Scale(geometry => $MaxSize . 'x' . $MaxSize);
	}

	# XXX Is it always ?
        $r->content_type('image/jpg');
        $r->rflush();

lib/Apache/Image.pm  view on Meta::CPAN

    module, including the names and locations of any configuration
    files, and the meaning of any environment variables or properties
    that can be set. These descriptions must also include details of any
    configuration language used.
  
Apache::Image requires no configuration files or environment variables.


=head1 DEPENDENCIES

Currently Image::Magick but soon to be Image::Thumbnail to allow independence
of backend.

Future to include another Image Thumbnail module for non images (movie frames,
word doc, pdf and others).

=head1 BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to



( run in 0.456 second using v1.01-cache-2.11-cpan-beeb90c9504 )