[Catalyst] Forms and Plugins and Tutorials, oh my!!

Alex Pavlovic alex at taskforce-1.com
Fri Aug 18 02:48:55 CEST 2006


Hi,

Unfortantely I cannot disclose the code as it belongs to a propriatery 
application. But the idea is very simple and described below. It uses 
filesystem for image storage, and database to store image filesystem path and 
identifier.

1.) Generate new UUID
	my $ug = Data::UUID->new;
	my $id = $ug->create_str(); 
2.) Create Image::Resize object from a stream sent by client e.g. 
	my $image =  Image::Resize->new( GD::Image->new( $stream ) );
3.) Resize according to specification without proportioning ( last arg )
	my $resized_image = $image->resize( $width, $height, 0 );
4.) Assign the proper image path
	my $img_path = "/path/to/somewhere/$id.jpg";
5.) Write converted stream back into filesystem
6.) Write path together with image id into database


Cheers.

On Thursday 17 August 2006 15:34, Jonathan Rockway wrote:
> That sounds like what I'm planning.  Is your code around somewhere (that
> you'd make available under the Perl license)?
>
> Alex Pavlovic wrote:
> > I use following
> >
> > Data::UUID ( so each image has unique identifier )
> > GD ( interface to GD )
> > Image::Resize ( nicer syntax )
> >
> > Plugin sounds intresting.
> >
> > Cheers.
> >
> > On Thursday 17 August 2006 10:39, Jonathan Rockway wrote:
> >> I am writing a plugin to do this as we speak.  Expect it to hit CPAN by
> >> the end of the weekend.  The API looks something like:
> >>
> >> my $image = $c->register_image('/path/to/the/image');
> >>
> >> $image will have methods like $image->url that return a fully-qualified
> >> URL that your web server can statically serve the image from.  You can
> >> also expire the images, delete them, get a scaled version (for exciting
> >> AJAX scaling effects; yay), etc.
> >>
> >> The details aren't completely worked out yet, though, and are subject to
> >> major changes.  (This was going to be a Controller in my app, but I
> >> guess a plugin is more useful to others.  Major change #1 :)
> >>
> >>> And now I have a couple of image plugin related questions.  Are there
> >>> any Catalyst plugins to help deal with uploaded images?  I'm looking
> >>> for something along the lines of:
> >>>
> >>>   1.  Generate a random name to avoid duplicate filename conflicts and
> >>> move the uploaded image to an image directory.
> >>>
> >>>   2.  Generate a thumbnail for the image.
> >>>
> >>>   3.  Store the needed image path and size info in a database.
> >>>
> >>>   4.  Helper functions to spit out an appropriate image tag in a
> >>> template for images in the database.
> >>
> >> "Images in the database"?  Depending on what these are, you might want
> >> to look up URI::data.
> >>
> >> data:text/x-perl,print%20%22Just%20another%20Catalyst%20hacker.%22
> >
> > _______________________________________________
> > List: Catalyst at lists.rawmode.org
> > Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> > Searchable archive:
> > http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site:
> > http://dev.catalyst.perl.org/
>
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/



More information about the Catalyst mailing list