Use derivative images generated by Image module for thumbnails

mglanznig - August 6, 2007 - 11:34
Project:PEAR Wiki Filter
Version:6.x-1.0-beta1
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work
Description

When using (e.g. in Mediawiki syntax) [[image:MyImage|thumb]] the derivative Thumbnail-Image generated by the Image module should be used. Currently the original image is transferred and resized by the browser. My patch is only a quick fix and only applicable to Mediawiki syntax. The two files pear_override/parse_mediawiki/Image.php and pear_override/render/Xhtml/Image.php have to be patched. The first with parse_image.patch and the latter with render_image.patch

AttachmentSize
parse_image.patch739 bytes

#1

mglanznig - August 6, 2007 - 11:35

Here's the one for pear_override/render/Xhtml/Image.php.

AttachmentSize
render_image.patch 1.17 KB

#2

asb - June 17, 2009 - 19:07
Version:5.x-1.1» 6.x-1.0-beta1

Hi,

in the D6 version, this issue still seems to exist. The render_image.patch does not apply cleanly in Pear Wiki Filter Module 6.x-1.0-beta1:

$ patch < render_image.patch
(Stripping trailing CRs from patch.)
patching file Image.php
Hunk #1 FAILED at 52.
1 out of 1 hunk FAILED -- saving rejects to file Image.php.rej

The contents of Image.php.rej is:

$ cat Image.php.rej
***************
*** 52,61 ****
 
          // note the image source
          $src = $options['src'];
         
          if (pearwiki_filter_use_image($pearwiki_current_format)) {
            // check if image node exists for this name
-           $image = db_fetch_object(db_query("SELECT n.nid, n.title, f.filename, f.filepath FROM {node} n LEFT JOIN {files} f ON n.nid = f.nid WHERE n.status = 1 AND n.type = 'image' AND LOWER(n.title) = LOWER('%s') LIMIT 1", $src));
            if ($image) {
              $src = file_create_url($image->filepath);
              if (!isset($options['attr']['alt'])) {
--- 52,65 ----
 
          // note the image source
          $src = $options['src'];
+
+         if (!isset($options['attr']['type'])) {
+           $options['attr']['type'] = '_original';
+         }
         
          if (pearwiki_filter_use_image($pearwiki_current_format)) {
            // check if image node exists for this name
+           $image = db_fetch_object(db_query("SELECT n.nid, n.title, f.filename, f.filepath FROM {node} n LEFT JOIN {files} f ON n.nid = f.nid WHERE n.status = 1 AND n.type = 'image' AND f.filename = '%s' AND LOWER(n.title) = LOWER('%s') LIMIT 1", $options['attr']['type'], $src));
            if ($image) {
              $src = file_create_url($image->filepath);
              if (!isset($options['attr']['alt'])) {

Has anyone re-rolled this patch or fixed this issue?

Thanks & greetings, -asb

#3

asb - July 20, 2009 - 09:30

Hi,

I tried those patches on another D6 installation where they applied cleanly (Debian GNU/Linux; above was FreeBSD):

# cd /var/www/sites/all/modules/pearwiki_filter
# cd pear_override/render/Xhtml/
# patch < render_image.patch
(Stripping trailing CRs from patch.)
patching file Image.php
# cd ../../parse_mediawiki/
# patch < parse_image.patch
(Stripping trailing CRs from patch.)
patching file Image.php

However, derivative images are still not rendered :-(

Greetings, -asb

 
 

Drupal is a registered trademark of Dries Buytaert.