Original fn field #5
3 changed files with 6 additions and 4 deletions
|
@ -144,6 +144,7 @@ get '/get_images' => ( authenticated => 1 ) => sub {
|
||||||
for my $img_item (@$files_list) {
|
for my $img_item (@$files_list) {
|
||||||
my $file = $img_item->{'file_name'};
|
my $file = $img_item->{'file_name'};
|
||||||
my $img_hash = {};
|
my $img_hash = {};
|
||||||
|
$img_hash->{'filename'} = $img_item->{'original_filename'};
|
||||||
$img_hash->{'original_url'} = File::Spec->catfile( '/', $IMAGE_BASE, $current_user->{'user_id'}, $ORIG_DIR, $file );
|
$img_hash->{'original_url'} = File::Spec->catfile( '/', $IMAGE_BASE, $current_user->{'user_id'}, $ORIG_DIR, $file );
|
||||||
$img_hash->{'thumbnail_url'} = File::Spec->catfile( '/', $IMAGE_BASE, $current_user->{'user_id'}, $thumbs_size, $file );
|
$img_hash->{'thumbnail_url'} = File::Spec->catfile( '/', $IMAGE_BASE, $current_user->{'user_id'}, $thumbs_size, $file );
|
||||||
|
|
||||||
|
@ -233,7 +234,7 @@ post '/upload' => ( authenticated => 1 ) => sub {
|
||||||
or die $scaled->errstr;
|
or die $scaled->errstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !$db->add_file( $user->{'user_id'}, $filename ) ) {
|
if ( !$db->add_file( $user->{'user_id'}, $filename, $image->filename) ) {
|
||||||
|
|
||||||
#TODO: Send error msg
|
#TODO: Send error msg
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,8 +51,8 @@ sub add_user($self, $username, $password, $fullname) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sub add_file($self, $user_id, $filename) {
|
sub add_file($self, $user_id, $filename, $original_filename) {
|
||||||
my $rows = $self->{'dbh'}->do(q~insert into images (owner_id, file_name) values (?, ?)~, undef, ($user_id, $filename));
|
my $rows = $self->{'dbh'}->do(q~insert into images (owner_id, file_name, original_filename) values (?, ?, ?)~, undef, ($user_id, $filename, $original_filename));
|
||||||
if ($self->{'dbh'}->errstr) {
|
if ($self->{'dbh'}->errstr) {
|
||||||
die $self->{'dbh'}->errstr;
|
die $self->{'dbh'}->errstr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
<div class="foto-block row" v-for="image in imagesList">
|
<div class="foto-block row" v-for="image in imagesList">
|
||||||
<div class="image col-md-3">
|
<div class="image col-md-3">
|
||||||
<img v-bind:src="image.thumbnail_url">
|
<img v-bind:src="image.thumbnail_url">
|
||||||
|
<div class="image_title">{{ image.filename }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="foto-notes col-md-3">
|
<div class="foto-notes col-md-3">
|
||||||
<ul>
|
<ul>
|
||||||
|
|
Loading…
Reference in a new issue