jQuery-File-Upload-Imager
view release on metacpan or search on metacpan
lib/jQuery/File/Upload/Imager.pm view on Meta::CPAN
Sets the minimum file size in bytes. Default minimum is 1 byte. to disable a minimum file size, you can set this to undef or 0.
=head3 accept_file_types
$j_fu->accept_file_types(['image/jpeg','image/png','image/gif','text/html']);
Sets what file types are allowed to be uploaded. By default, all file types are allowed.
File types should be in the format of the Content-Type header sent on requests.
=head3 require_image
$j_fu->require_image(1);
If set to 1, it requires that all uploads must be an image. Setting this is equivalent
to calling:
$j_fu->accept_file_types(['image/jpeg','image/jpg','image/png','image/gif']);
Default is undef.
=head3 delete_params
$j_fu->delete_params(['key1','val1','key2','val2']);
Sets the keys and values of the params added to the delete_url.
This can be useful when used with L</pre_delete>,
because if you are keeping track of these files in a database,
you can add unique identifiers to the params so that in L</pre_delete>
you can get these unique identifiers and use them to remove or edit the file
in the databse. By default filename will also be a param unless you
set the delete_url manually.
=head3 delete_url
$j_fu->delete_url('http://www.mydomain.com/upload.cgi?filename=file.jpg');
This can be used to set the delete_url that will be requested when
a user deletes a file. However, it is recommended that you do not
set this manually and rather use L</delete_params>
if you want to add your own params to the delete_url.
=head3 thumbnail_width
$j_fu->thumbnail_width(80);
This sets the width for the thumbnail that will be created if the
file is an image. Default is 80.
=head3 thumbnail_height
$j_fu->thumbnail_height(80);
This sets the height for the thumbnail that will be created if the
file is an image. Default is 80.
=head3 tumbnail_quality
$j_fu->thumbnail_quality(70);
This sets the quality of the generated thumbnail. Default is 70 and it
can be on a scale of 0-100. See L<Image::Magick> for more information.
=head3 thumbnail_quality
$j_fu->thumbnail_quality(70);
This sets the quality of the thumbnail image. Default is 70 and it
can be on a scale of 0-100. See L<Image::Magick> for more information.
=head3 thumbnail_format
$j_fu->thumbnail_format('jpg');
Sets the format for the generated thumbnail. Can be jpg, png, or gif.
See L<Image::Magick> for more information. Defaults to jpg.
=head3 thumbnail_density
$j_fu->thumbnail_density('80x80');
Sets the density for the generated thumbnail. Default is width x height.
See L<Image::Magick> for more information.
=head3 thumbnail_prefix
$j_fu->thumbnail_prefix('thumb_');
Added before the image filename to create the thumbnail unique filename.
Default is 'thumb_'.
=head3 thumbnail_postfix
$j_fu->thumbnail_postfix('_thumb');
Added after the image filename to create the thumbnail unique filename.
Default is ''.
=head3 thumbnail_final_width
my $final_width = $j_fu->thumbnail_final_width;
Because the thumbnails are scaled proportionally, the thumbnail width
may not be what you orignally suggested. This gets you the final width.
=head3 thumbnail_final_height
my $final_height = $j_fu->thumbnail_final_height;
Because the thumbnails are scaled proportionally, the thumbnail height
may not be what you orignally suggested. This gets you the final height.
=head3 quality
$j_fu->quality(70);
This sets the quality of the uploaded image. Default is 70 and it
can be on a scale of 0-100. See L<Image::Magick> for more information.
=head3 format
$j_fu->format('jpg');
Sets the format for the generated thumbnail. Can be jpg,png, or gif.
See L<Image::Magick> for more information. Defaults to jpg.
=head3 final_width
my $final_width = $j_fu->final_width;
Returns the final width of the uploaded image.
=head3 final_height
my $final_height = $j_fu->final_height;
Returns the final height of the uploaded image.
=head3 max_width
$j_fu->max_width(10000);
Sets the maximum width of uploaded images. Will return an error to browser if not
valid. Default is any width.
=head3 max_height
$j_fu->max_height(10000);
Sets the maximum height of uploaded images. Will return an error to browser if not
valid. Default is any height.
=head3 min_width
$j_fu->min_width(10000);
Sets the minimum width of uploaded images. Will return an error to browser if not
valid. Default is 1.
=head3 min_height
$j_fu->min_height(10000);
Sets the minimum height of uploaded images. Will return an error to browser if not
valid. Default is 1.
=head3 max_number_of_files
$j_fu->max_number_of_files(20);
Sets the maximum number of files the upload directory can contain. Returns an error
to the browser if number is reached. Default is any number of files. If you have
listed multiple remote directories, the maximum file count out of all of these directories
is what will be used.
=head3 filename
my $filename = $j_fu->filename;
Returns the resulting filename after processing the request.
$j_fu->filename('my_name.txt');
You can also set the filename to use for this request before you call
L<handle_request>. However, unless you're sure
lib/jQuery/File/Upload/Imager.pm view on Meta::CPAN
L<Moose> attribute to the class:
use jQuery::File::Upload::Imager;
has 'j_uf' => (isa => 'jQuery::File::Upload::Imager', is => 'rw',
lazy => 0, default => sub { jQuery::File::Upload::Imager->new } );
However, if you do this it is possible that you could run into issues
with values of the jQuery::File::Upload::Imager object that were not cleared
messing with the current request. The _clear method is called before
every L</handle_request> which clears the values of
the jQuery::File::Upload::Imager object, but it's possible I may have
missed something. You did! See the L</FAQ>.
=head1 SEE ALSO
=over 4
=item
L<CGI>
=item
L<JSON::XS>
=item
L<Net::SSH2>
=item
L<Net::SSH2::SFTP>
=item
L<Imager>
=item
L<Cwd>
=item
L<Digest::MD5>
=item
L<URI>
=item
L<jQuery File Upload|https://github.com/blueimp/jQuery-File-Upload/>
=back
=head1 AUTHOR
Adam Hopkins, E<lt>srchulo@cpan.org<gt>
Ron Savage I<E<lt>ron@savage.net.auE<gt>> has patched jQuery::File::Upload V 0.16
to use L<Imager> rather than L<Image::Magick>, on 2013-05-23. See the L</FAQ> for details.
=head1 Bugs
I haven't tested this too thoroughly beyond my needs, so it is possible
that I have missed something. If I have, please feel free to submit a bug
to the bug tracker, and you can send me an email letting me know that you
submitted a bug if you want me to see it sooner :)
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2013 by Adam Hopkins
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.
=cut
( run in 1.143 second using v1.01-cache-2.11-cpan-39bf76dae61 )