* updated korganizer (21.12.1 -> 21.12.2), untested
[t2-trunk.git] / package / graphic / cthumb / png.patch
blobf13bf2b2315a7660f0a7f6506acfcaef0fa08218
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
3 #
4 # T2 SDE: package/.../cthumb/png.patch
5 # Copyright (C) 2004 - 2005 The T2 SDE Project
6 #
7 # More information can be found in the files COPYING and README.
8 #
9 # This patch file is dual-licensed. It is available under the license the
10 # patched project is licensed under, as long as it is an OpenSource license
11 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
12 # of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
14 # version.
15 # --- T2-COPYRIGHT-NOTE-END ---
16 diff -ruN cthumb-4.2/cthumb.in cthumb-4.2-new/cthumb.in
17 --- cthumb-4.2/cthumb.in 2002-08-13 19:24:05.000000000 +0200
18 +++ cthumb-4.2-new/cthumb.in 2004-04-04 12:59:31.842021168 +0200
19 @@ -707,7 +707,7 @@
20 my $pic = shift;
22 # $pic =~ /^(.*?)(\.gif|\.jpg)?$/;
23 - $pic =~ m#^(.*/)?([^/]+)\.(gif|tif+|jpe?g)$#i;
24 + $pic =~ m#^(.*/)?([^/]+)\.(gif|tif+|jpe?g|png)$#i;
25 # use thumb/ subdirectory if it already exists
26 my $base = (defined($1))? $1 : '';
27 if (-w ($base . "thumb")) {
28 @@ -742,6 +742,8 @@
30 for my $cmd ("djpeg", "pngtopnm", "giftopnm", "tifftopnm") {
31 my $pnm = `$cmd "$name" `;
32 + if ($pnm eq "") { print "not with $cmd ... "; }
33 + else { print "with $cmd ..."; } ;
34 return $pnm unless $?;
36 return;
37 @@ -1069,14 +1071,14 @@
38 $pictureGeometry,
39 $pictureSize,
40 $pictureTitle,
41 - $pictureStory,
42 - $pictureTimestamp,
43 - $albumURL,
44 - $albumTitle,
45 - $geometryLink,
46 - $themePrefix);
47 - }
48 - }
49 + $pictureStory,
50 + $pictureTimestamp,
51 + $albumURL,
52 + $albumTitle,
53 + $geometryLink,
54 + $themePrefix);
59 # This function is responsible for generating html for a single image that
60 @@ -1715,7 +1717,7 @@
62 my $pnm = "";
63 if (!($pnm = &get_pnm($src))) {
64 - die "Cannot scale image `$dest`.";
65 + warn "Cannot scale image `$dest`, cthumb will fail!";
67 # make pnmscale shut up (version in redhat 7.2
68 # spits out stuff to stderr, even without -verbose, arggh)
69 @@ -1730,7 +1732,7 @@
70 close PNMTOTHUMB;
71 print "done.\n";
72 } else {
73 - die "Cannot scale image `$dest`.";
74 + warn "Cannot scale image `$dest`.";
78 @@ -1766,6 +1768,17 @@
82 + if ($picname =~ /\.png$/i) {
83 + open FILE, "pngtopnm \"$picname\" | pnmfile |" or
84 + return "";
85 + $_ = <FILE>;
86 + if (/^stdin:\s+PPM raw, (\d+) by (\d+)/) {
87 + $width = $1; $height = $2;
88 + close FILE;
89 + return "$width" . "x" . "$height";
90 + }
91 + }
93 return "";