Page 2 of 3
Re: thumbnail of pdf - wrong filename
Posted: Fri Jul 10, 2009 6:28 pm
by stm999999999
at first view: works very fine!
question to other imagemagick/pdf-users here:
Please take an upload a pdf with more than one page - which page is displayed in the thumb? the first or the last?
Re: thumbnail of pdf - wrong filename
Posted: Fri Jul 10, 2009 6:54 pm
by garvinhicking
Hi!
imagemagick always uses the first page.
Regards,
Garvin
Re: thumbnail of pdf - wrong filename
Posted: Fri Jul 10, 2009 7:30 pm
by stm999999999
sadly: no
BTDT
Re: thumbnail of pdf - wrong filename
Posted: Fri Jul 10, 2009 8:56 pm
by garvinhicking
Hi!
Hm, you are right. Strange, I could have sworn it was always the first page.
Try this patch:
Code: Select all
Index: include/functions_images.inc.php
===================================================================
--- include/functions_images.inc.php (revision 2545)
+++ include/functions_images.inc.php (working copy)
@@ -659,7 +659,7 @@
}
$newSize = $r['width'] . 'x' . $r['height'];
if ($fdim['mime'] == 'application/pdf') {
- $cmd = escapeshellcmd($serendipity['convert']) . ' -antialias -flatten -scale '. serendipity_escapeshellarg($newSize) .' '. serendipity_escapeshellarg($infile) .' '. serendipity_escapeshellarg($outfile . '.png');
+ $cmd = escapeshellcmd($serendipity['convert']) . ' -antialias -flatten -scale '. serendipity_escapeshellarg($newSize) .' "'. serendipity_escapeshellarg($infile) .'[0]" '. serendipity_escapeshellarg($outfile . '.png');
} else {
if (!$force_resize && serendipity_ini_bool(ini_get('safe_mode')) === false) {
$newSize .= '>'; // Tell imagemagick to not enlarge small images, only works if safe_mode is off (safe_mode turns > in to \>)
HTH,
Garvin
Re: thumbnail of pdf - wrong filename
Posted: Fri Jul 10, 2009 9:49 pm
by stm999999999
hm ...
Code: Select all
Konnte folgendes Programm nicht ausführen: "/usr/local/bin/convert -antialias -flatten -scale '130x130' "'/srv/xxx/uploads/intern/Einladung_Radtour_Juli_2009.pdf'[0]" '/srv/xxx/uploads/intern/Einladung_Radtour_Juli_2009.serendipityThumb.pdf.png'", Fehlermeldung: , Rückgabewert: 1
Re: thumbnail of pdf - wrong filename
Posted: Fri Jul 10, 2009 10:37 pm
by garvinhicking
Hi!"
Hm, seems the qupotes would need to be adjusted:
/usr/local/bin/convert -antialias -flatten -scale '130x130' '/srv/xxx/uploads/intern/Einladung_Radtour_Juli_2009.pdf'[0] '/srv/xxx/uploads/intern/Einladung_Radtour_Juli_2009.serendipityThumb.pdf.png'
Regards,
garvin
Re: thumbnail of pdf - wrong filename
Posted: Fri Jul 10, 2009 10:40 pm
by stm999999999
Now I tried this code with success:
Code: Select all
$cmd = escapeshellcmd($serendipity['convert']) . ' -antialias -flatten -scale '. serendipity_escapeshellarg($newSize) .' '. serendipity_escapeshellarg($infile) .'[0] '. serendipity_escapeshellarg($outfile . '.png');
so I think it will get this command:
Code: Select all
/usr/local/bin/convert -antialias -flatten -scale '130x130' '/srv/xxx/uploads/intern/Einladung_Radtour_Juli_2009.pdf'[0] '/srv/xxx/uploads/intern/Einladung_Radtour_Juli_2009.serendipityThumb.pdf.png'
But honestly I do not know why it works with '/srv/xxx/uploads/intern/Einladung_Radtour_Juli_2009.pdf'[0]
http://www.imagemagick.org/Usage/files/ ... postscript says it has to be
Code: Select all
convert document.pdf'[0]' first_page_of_pdf.gif
but I have:
but
http://www.imagemagick.org/script/comma ... .php#input says:
Selecting Frames
Some images formats contain more than one image frame. Perhaps you only want the first image, or the last, or some number of images in-between. You can specify which image frames to read by appending the image filename with the frame range enclosed in brackets. Here our image (an animated GIF) contains more than one frame but we only want the first:
$magick> convert 'images.gif[0]' image.png
[Unix shells generally interpret brackets so we enclosed the filename in quotes above. In a Windows command shell the brackets are not interpreted but using quotes doesn't hurt. However, in most cases the roles of single-quotes and dowuble-quotes are reversed with respect to Unix and Windows, so Windows users should usually try double-quotes where we display single-quotes, and vice versa.]
Re: thumbnail of pdf - wrong filename
Posted: Fri Jul 10, 2009 10:45 pm
by stm999999999
ha, I think this would be the right code!
Code: Select all
$cmd = escapeshellcmd($serendipity['convert']) . ' -antialias -flatten -scale '. serendipity_escapeshellarg($newSize) .' '. serendipity_escapeshellarg($infile.'[0]') .' '. serendipity_escapeshellarg($outfile . '.png');
so we get
Code: Select all
/usr/local/bin/convert -antialias -flatten -scale '130x130' '/srv/xxx/uploads/intern/BriefOstern2009single1.pdf[0]' '/srv/xxx/uploads/intern/BriefOstern2009single1.serendipityThumb.pdf.png'
and all is within the quotes!
Re: thumbnail of pdf - wrong filename
Posted: Fri Jul 10, 2009 10:58 pm
by stm999999999
and now it would be fine to get the fix for the first problem (no thumbnail) for the gallery-plugin:
so that there is a thumbnail here, too:
http://www.sankt-joseph-siemensstadt.de ... 009-03-21/
(in the media library there is shown the thumbnail now.)
and another thing, related to the new functionality of pdf-thumbs:
selecting a pdf in the library I get the some options like for images, especially "thumb or the larger image?". Taking the thumb all works fine,
now
But using larger image:
Code: Select all
<a class='serendipity_image_link' href='/uploads/Artikel/Gruppen/Ministranten/neue-minis-2009-joseph.pdf'><!-- s9ymdb:640 --><img width='1000' height='1000' style="border: 0px; padding-left: 5px; padding-right: 5px;" src="/uploads/Artikel/Gruppen/Ministranten/neue-minis-2009-joseph.pdf" alt="" /></a>
looks not realy good: a pdf as an image src
What is about this idea: no "thumb or larger image" but "thumbnail or text-link (as before the fix)"?
Re: thumbnail of pdf - wrong filename
Posted: Sat Jul 11, 2009 9:07 am
by randulo
Very cool, Garvin, thanks!
Re: thumbnail of pdf - wrong filename
Posted: Mon Jan 18, 2010 5:16 pm
by stm999999999
After updating to the actual release of s9y I got the error again - unfortunately my last patch for this did not found his way to the repositry
@garvin: please change the convert command in include/functions_images.inc.php
Code: Select all
$cmd = escapeshellcmd($serendipity['convert']) . ' -antialias -flatten -scale '. serendipity_escapeshellarg($newSize) .' '. serendipity_escapeshellarg($infile.'[0]') .' '. serendipity_escapeshellarg($outfile . '.png');
Re: thumbnail of pdf - wrong filename
Posted: Tue Jan 19, 2010 10:48 am
by garvinhicking
Hi!
Thanks, committed! I thought I had this earlier, so sorry
Regards,
Garvin
Re: thumbnail of pdf - wrong filename
Posted: Wed Jan 20, 2010 12:10 am
by stm999999999
garvinhicking wrote:Hi!
Thanks, committed!
never mind!
So, can we now turn towards the two little problems in
http://board.s9y.org/viewtopic.php?p=88594#p88594?
Please!
Re: thumbnail of pdf - wrong filename
Posted: Wed Jan 20, 2010 11:25 am
by garvinhicking
Hi!
Which little problems? You linked to this thread?!
Regards,
Garvin
Re: thumbnail of pdf - wrong filename
Posted: Wed Jan 20, 2010 4:28 pm
by stm999999999
garvinhicking wrote:Hi!
Which little problems? You linked to this thread?!
öh, yes. I mean the two things in post #88594
http://board.s9y.org/viewtopic.php?p=88594#p88594
no thumbnail in the the gallery-plugin
and
"looks not realy good: a pdf as an image src"