diff options
author | dakkar <dakkar@luxion> | 2005-10-20 13:41:27 +0000 |
---|---|---|
committer | dakkar <dakkar@luxion> | 2005-10-20 13:41:27 +0000 |
commit | 4e380e6e3fb55cdb63e2399614184a85e4475e30 (patch) | |
tree | 492643ebc1daad16e41cf958d54af53f9f6e1a5c /lib | |
parent | ancora non inserisce le icone: se si fa bind_param($pos,$blob_data,DBI::SQL_B... (diff) | |
download | Bookmarks-4e380e6e3fb55cdb63e2399614184a85e4475e30.tar.gz Bookmarks-4e380e6e3fb55cdb63e2399614184a85e4475e30.tar.bz2 Bookmarks-4e380e6e3fb55cdb63e2399614184a85e4475e30.zip |
ora gestisce le icone, ma devo tenerle in un TEXT, base64, causa bug in DBD::SQLite
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Bookmarks/C/Main.pm | 4 | ||||
-rw-r--r-- | lib/Bookmarks/M/DB/Links.pm | 13 |
2 files changed, 12 insertions, 5 deletions
diff --git a/lib/Bookmarks/C/Main.pm b/lib/Bookmarks/C/Main.pm index 89c985d..b25ef9a 100644 --- a/lib/Bookmarks/C/Main.pm +++ b/lib/Bookmarks/C/Main.pm @@ -50,9 +50,9 @@ sub icon : Global { my ( $self, $c ) = @_; my $link=Bookmarks::M::DB::Links->retrieve($c->req->param('link')); - if ($link->icon()) { + if ($link->get_icon()) { $c->res->content_type('image/x-icon'); - $c->res->body($link->icon()); + $c->res->body($link->get_icon()); } else { $c->res->status(404); diff --git a/lib/Bookmarks/M/DB/Links.pm b/lib/Bookmarks/M/DB/Links.pm index 92fd74b..1719770 100644 --- a/lib/Bookmarks/M/DB/Links.pm +++ b/lib/Bookmarks/M/DB/Links.pm @@ -1,6 +1,6 @@ package Bookmarks::M::DB::Links; use strict; -use DBI; +use MIME::Base64; for my $col_name (qw(add_date last_access_date)) { __PACKAGE__->has_a( $col_name => 'DateTime', @@ -9,9 +9,16 @@ for my $col_name (qw(add_date last_access_date)) { ); } -__PACKAGE__->has_many( tags => ['Bookmarks::M::DB::LinksTags' => 'tag'] ); +sub set_icon { + my ($self,$icon)=@_; + $self->icon(encode_base64($icon)); +} +sub get_icon { + my ($self)=@_; + return decode_base64($self->icon()); +} -__PACKAGE__->data_type( icon => DBI::SQL_BLOB ); +__PACKAGE__->has_many( tags => ['Bookmarks::M::DB::LinksTags' => 'tag'] ); =head1 NAME |