/[Arh]/lib/Arh/Model/Picture.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /lib/Arh/Model/Picture.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 61 - (hide annotations)
Mon Apr 7 14:33:31 2008 UTC (16 years, 1 month ago) by dpavlin
File size: 1456 byte(s)
remove usage of Imager and use Image::Magick instead which will result in
better support for different image formats, serve static thumbs for now
through symlink
1 dpavlin 4 use strict;
2     use warnings;
3    
4     package Arh::Model::Picture;
5     use Jifty::DBI::Schema;
6 dpavlin 6 use File::Find;
7     use Data::Dump qw/dump/;
8 dpavlin 4
9     use Arh::Record schema {
10    
11 dpavlin 44 column filename =>
12     label is _("Picture filename");
13     # is immutable,
14     # is indexed,
15     # is unique;
16    
17     column content =>
18     label is _('Picture'),
19     type is 'bytea',
20 dpavlin 53 # render as 'Upload',
21     render as 'Arh::Web::Form::Field::Upload',
22 dpavlin 44 is mandatory;
23    
24 dpavlin 4 column campaign =>
25     label is _("Part of campaign"),
26     refers_to Arh::Model::Campaign,
27 dpavlin 17 is mandatory,
28 dpavlin 4 is indexed,
29     since '0.0.4';
30    
31     column type =>
32     label is _("Type of picture"),
33     refers_to Arh::Model::PictureType,
34 dpavlin 17 is mandatory,
35 dpavlin 4 is indexed,
36 dpavlin 5 since '0.0.4';
37 dpavlin 4
38 dpavlin 50 column unit =>
39     label is _('Unit'),
40     refers_to Arh::Model::Unit,
41     is mandatory,
42     is indexed;
43    
44 dpavlin 61 column thumbnail =>
45     label is _('Thumbnail name'),
46     is indexed;
47    
48     column width =>
49     label is _('Thumbnail width'),
50     type is 'int';
51    
52     column height =>
53     label is _('Thumbnail height'),
54     type is 'int';
55    
56 dpavlin 4 };
57    
58     # Your model-specific methods go here.
59    
60 dpavlin 6 sub all_filenames {
61    
62     my @files;
63     my $path = Jifty::Util->app_root . '/share/web/static/pics';
64    
65 dpavlin 13 # warn "## path = $path";
66 dpavlin 6
67     find({ wanted => sub {
68     my $f = $File::Find::name;
69     return unless -f $f;
70     push @files, $_;
71     }, follow => 0 }, $path);
72    
73 dpavlin 13 # warn "## all_filenames = ",dump( @files );
74 dpavlin 6
75     return @files;
76     }
77    
78 dpavlin 10 #use Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata; # created_by, created_on, updated_on
79    
80 dpavlin 13 use Arh::DefaultACL;
81 dpavlin 10
82 dpavlin 4 1;
83    

  ViewVC Help
Powered by ViewVC 1.1.26