Solstice
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
requires 'File::MMagic' => 0;
requires 'File::Path' => 0;
requires 'File::stat' => 0;
requires 'HTML::Entities' => 0;
requires 'HTML::Formatter' => 0;
requires 'HTML::FormatText' => 0;
requires 'HTML::Parser' => 0;
requires 'HTML::StripScripts' => 0;
requires 'HTML::TreeBuilder' => 0;
requires 'HTTP::BrowserDetect' => 0;
requires 'Image::Magick' => 0;
requires 'JSON' => 0;
requires 'Mail::Sender' => 0;
requires 'MIME::Base64' => 0;
requires 'Module::Build::Compat' => 0; #this is to prod FormValidator's prereq Image::Size into working
requires 'Sys::Hostname' => 0;
requires 'Time::HiRes' => 0;
requires 'Unicode::String' => 0;
requires 'UNIVERSAL' => 0;
requires 'URI' => 0;
requires 'URI::Escape' => 0;
lib/Solstice/Resource/File/BlackBox.pm view on Meta::CPAN
use 5.006_000;
use strict;
use warnings;
use base qw(Solstice::Resource::File);
use Solstice::Database;
use Solstice::DateTime;
use Solstice::Encryption;
use Image::Magick;
use Digest::MD5 qw(md5_hex);
use constant TRUE => 1;
use constant FALSE => 0;
use constant FILE_ROOT => 'solstice/files';
our ($VERSION) = ('$Revision: 924 $' =~ /^\$Revision:\s*([\d.]*)/);
=head2 Superclass
lib/Solstice/Resource/File/BlackBox.pm view on Meta::CPAN
}
close($FILE);
$self->_setFilehandle(undef);
$self->_setPerlFilehandle(undef);
my $ct_service = $self->getContentTypeService();
if ($ct_service->isKnownType($self->getContentType())) {
# Images only: get width and height attributes once
if ($ct_service->isImageType($self->getContentType())) {
my $image = Image::Magick->new();
my $msg = $image->Read(filename => $file_path);
unless ($msg && $msg !~ /^Exception (415|420)/) {
$self->setAttribute('width', $image->Get('width'));
$self->setAttribute('height', $image->Get('height'));
}
}
} else {
# Log the unknown content types
$self->getLogService()->log({
log_file => 'unknown_content_types',
lib/Solstice/Resource/File/Thumbnail.pm view on Meta::CPAN
=head1 DESCRIPTION
=cut
use 5.006_000;
use strict;
use warnings;
use base qw(Solstice::Resource::File);
use Image::Magick;
use Time::HiRes qw(time);
use constant TRUE => 1;
use constant FALSE => 0;
use constant DEFAULT_LENGTH => 32;
use constant WIDTH_MULTIPLIER => 1.6;
our ($VERSION) = ('$Revision: 924 $' =~ /^\$Revision:\s*([\d.]*)/);
lib/Solstice/Resource/File/Thumbnail.pm view on Meta::CPAN
my $cache_path;
if (defined $self->getOwner() && defined $self->_getCacheName()) {
$cache_path = $self->_generateThumbnailPath();
$self->_dirCheck($cache_path);
$cache_path .= $self->_getCacheName();
}
# Read the file from a filehandle
my $image = Image::Magick->new();
my $msg = $image->Read(filename => $path);
if ($msg) {
warn "Image::Magick was unable to read filehandle: $msg" unless $msg =~ /^Exception (415|420)/;
return FALSE;
}
# This pulls out the first frame of animated gifs
# TODO: accessor to control this?
# $image = $image->[0] if $image->[0];
my ($width, $height) = $image->Get('width', 'height');
# Resize if needed
lib/Solstice/Resource/File/Thumbnail.pm view on Meta::CPAN
# But not TOO wide...
if ($width > $max_length) {
($height = int($height / $width * $max_length) || 1, $width = $max_length);
}
$image->Resize(width => $width, height => $height);
}
$msg = $image->Write($cache_path || $path);
#if ($msg) {
# warn "Image::Magick was unable to write to ".($cache_path || $path).": $msg";
# return FALSE;
#}
if (defined $cache_path) {
$self->_setPath($cache_path);
$self->_setIsCached(TRUE);
unlink($path);
}
return TRUE;
( run in 1.495 second using v1.01-cache-2.11-cpan-beeb90c9504 )