thumbnail of pdf - wrong filename

Found a bug? Tell us!!
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Re: thumbnail of pdf - wrong filename

Post by stm999999999 »

at first view: works very fine! :D

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?
Ciao, Stephan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: thumbnail of pdf - wrong filename

Post by garvinhicking »

Hi!

imagemagick always uses the first page.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Re: thumbnail of pdf - wrong filename

Post by stm999999999 »

sadly: no

BTDT
Ciao, Stephan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: thumbnail of pdf - wrong filename

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Re: thumbnail of pdf - wrong filename

Post 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
Ciao, Stephan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: thumbnail of pdf - wrong filename

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Re: thumbnail of pdf - wrong filename

Post 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.]
Ciao, Stephan
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Re: thumbnail of pdf - wrong filename

Post 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! :)
Ciao, Stephan
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Re: thumbnail of pdf - wrong filename

Post 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 :D

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 :x :cry:

What is about this idea: no "thumb or larger image" but "thumbnail or text-link (as before the fix)"?
Ciao, Stephan
randulo
Regular
Posts: 141
Joined: Thu Jul 21, 2005 10:28 am

Re: thumbnail of pdf - wrong filename

Post by randulo »

Very cool, Garvin, thanks!
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Re: thumbnail of pdf - wrong filename

Post 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');
Ciao, Stephan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: thumbnail of pdf - wrong filename

Post by garvinhicking »

Hi!

Thanks, committed! I thought I had this earlier, so sorry :(

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Re: thumbnail of pdf - wrong filename

Post 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! :mrgreen:
Ciao, Stephan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: thumbnail of pdf - wrong filename

Post by garvinhicking »

Hi!

Which little problems? You linked to this thread?!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Re: thumbnail of pdf - wrong filename

Post 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"
Ciao, Stephan
Post Reply