Browse Source

handle documents without pages

master
Pascal Gloor 5 years ago
parent
commit
3a9582d8b2
1 changed files with 20 additions and 7 deletions
  1. 20
    7
      cgi/autodoc.fcgi

+ 20
- 7
cgi/autodoc.fcgi View File

$size = $qs->{maxWidth}; $size = $qs->{maxWidth};
} }


if ( !defined $id ) {
return gen_error_img($wh, $size, "No page found");
}

my $original = sprintf("%s/%s/%s.jpeg", my $original = sprintf("%s/%s/%s.jpeg",
$conf->{path}{global}, $conf->{path}{original}, $id); $conf->{path}{global}, $conf->{path}{original}, $id);


my $cache_file = sprintf("%s/%s/%s-original.jpeg", my $cache_file = sprintf("%s/%s/%s-original.jpeg",
$conf->{path}{global}, $conf->{path}{images}, $id);
$conf->{path}{global}, $conf->{path}{images}, $id);


if ( defined $wh && defined $size ) { if ( defined $wh && defined $size ) {
$cache_file = sprintf("%s/%s/%s-%s-%s.jpeg", $cache_file = sprintf("%s/%s/%s-%s-%s.jpeg",
$conf->{path}{global}, $conf->{path}{images}, $id, $wh, $size); $conf->{path}{global}, $conf->{path}{images}, $id, $wh, $size);
} }



gen_thumbnail($original, $cache_file, $wh, $size) if !-r $cache_file; gen_thumbnail($original, $cache_file, $wh, $size) if !-r $cache_file;


my $img=''; my $img='';
$img = gen_error_img($wh, $size, "No Image"); $img = gen_error_img($wh, $size, "No Image");
} }


return (200, "image/jpeg", $img);
return $img;
} }


sub gen_thumbnail { sub gen_thumbnail {
} }


sub api_v1_POST_documents_id_data { return api_error(501,"Not yet implemented"); } sub api_v1_POST_documents_id_data { return api_error(501,"Not yet implemented"); }

# get document image/thumbnail
sub api_v1_GET_documents_id_image { sub api_v1_GET_documents_id_image {
my($id, $qs, $post, $user) = @_;
my($id, $qs, $post, $user) = @_;


my $pageid;


return api_error(501,"Not yet implemented");
my $q = sqlquery($dbh, "SELECT id FROM pages WHERE documentId = ? ORDER BY id DESC LIMIT 1", $id);
while(my($myid)=$q->fetchrow_array()) {
$pageid = $myid;
}

return api_v1_GET_documents_id_image($pageid, $qs, $post, $user);
} }

# get page image/thumbnail
sub api_v1_GET_pages_image { sub api_v1_GET_pages_image {
my($id, $qs, $post, $user) = @_; my($id, $qs, $post, $user) = @_;
get_page_image($id, $qs);
return api_error(501,"Not yet implemented");
return (200, "image/jpeg", get_page_image($id, $qs));
} }


# get a list of document objects # get a list of document objects

Loading…
Cancel
Save