[Catalyst] (Beginner) Plugins

Alejandro Imass alejandro.imass at gmail.com
Tue Oct 24 17:34:05 BST 2006


Yes, sorry, I was lazy in my answer. I meant that this whole thing seemed
too much trouble. It seems that by setting the proportion fixed (fixing the
w/h ratio) I can generate the image only once on the server and the resize
with CSS and JS.

Thanks for pointing this out though.


On 10/24/06, Jonathan Rockway <jon at jrock.us> wrote:
>
> > If the image name had the dimensions I could check if that particular
> > image was already generated, but it looks like too much trouble.
>
> That's what this code does:
>
>     my $key =3D join(":", $width, $height, $image );
>     my $scaled =3D $cache->get($key);
>     unless ( defined $scaled ) { ... $scaled =3D scale_the_image() ... }
>
> If the image was in cache, the unless(){} block is skipped, and the
> cached version is stored.  If the image wasn't in cache, it's scaled and
> then stored in the cache.  The $c->cache handles expiration, elimination
> of duplicate entries, etc.
>
> Regards,
> Jonathan Rockway
>
> --
> package JAPH;use Catalyst qw/-Debug/;($;=3DJAPH)->config(name =3D> do {
> $,.=3Dreverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
> ";$;"]->[$_].q; ;for 1..4;$,=3D~s;^.;;;$,});$;->setup;
>
> _______________________________________________
> 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/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jules.scsys.co.uk/pipermail/catalyst/attachments/20061024/5af22=
878/attachment.htm


More information about the Catalyst mailing list