From: garvinhicking Date: Wed, 3 Aug 2005 23:19:01 +0000 (+0000) Subject: backport X-Git-Tag: 0.8.3~7 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=abef97fcacd8fcd7d2df5f89f6b6430549bf51a7;p=s9y.git backport --- diff --git a/include/functions_images.inc.php b/include/functions_images.inc.php index d6a89c3..18a8a4f 100644 --- a/include/functions_images.inc.php +++ b/include/functions_images.inc.php @@ -1102,11 +1102,16 @@ if ( !$manage ) { } } // End serendipity_displayImageList() -function serendipity_isImage(&$file) { +function serendipity_isImage(&$file, $strict = false) { + global $serendipity; + $file['displaymime'] = $file['mime']; + // Strip HTTP path out of imgsrc + $file['location'] = $serendipity['serendipityPath'] . preg_replace('@^(' . preg_quote($serendipity['serendipityHTTPPath']) . ')@i', '', $file['imgsrc']); + // File is PDF -> Thumb is PNG - if ($file['mime'] == 'application/pdf') { + if ($file['mime'] == 'application/pdf' && file_exists($file['location'] . '.png') && $strict == false) { $file['imgsrc'] .= '.png'; $file['displaymime'] = 'image/png'; } diff --git a/serendipity_admin_image_selector.php b/serendipity_admin_image_selector.php index cdafd98..0295eea 100644 --- a/serendipity_admin_image_selector.php +++ b/serendipity_admin_image_selector.php @@ -95,7 +95,7 @@ switch ($serendipity['GET']['step']) { $thumbName = $serendipity['serendipityHTTPPath'] . $serendipity['uploadHTTPPath'] . $thumbbasename; } $thumbsize = @getimagesize($serendipity['serendipityPath'] . $serendipity['uploadPath'] . $thumbbasename); - $is_image = serendipity_isImage($file); + $is_image = serendipity_isImage($file, true); ?>