what is the exact mechanism of this dynamic style of serving images? Explain it in a few words.

What about the way image_assist guys use - a [image ... ] input filter. This makes things dynamic too - do you have sth against it that kept you from using it?

Comments

jdelaune’s picture

Status: Active » Postponed

This will be solved in v2 of ImageBrowser. The main issue was with [] tags you wouldn't see the actual images in WYSIWYG editors. But the alpha version of v2 has solved that.

rsvelko’s picture

img_assist had the same problem and since months it got resolved.

1. When you adopt [] tags will you throw away the now-used dynamic serve method? Just curious.

note: using [] tags resolves the issue with print module not finding images too . Although it seems that it is their bug not yours .

jdelaune’s picture

rsvelko mind testing this out for me and letting me know what results you get. Seems to be working ok for me.

I was using an Image (module) function to return the images but I realise this may not be ideal with the issue above.

If you go to the imagebrowser_view_image() function in imagebrowser.module (line 545).

Replace the line:

image_fetch($nid, $size);

with:

$node = node_load(array('type' => 'image', 'nid' => $nid));
$file = $node->images[$size];
header('Location: '.base_path().$file);

Let me know if this helps with your YSlow stats as well.

rsvelko’s picture

Status: Postponed » Needs review

Yes, that fixed the Yslow part. +1 for us :)

A patch to come would be great:

here is the image_fetch func


/**
 * Fetches an image file, allows "shorthand" image urls such of the form:
 * image/view/$nid/$label
 * (e.g. image/view/25/thumbnail or image/view/14)
 */
function image_fetch($nid = 0, $size = IMAGE_PREVIEW) {
  if ($size == IMAGE_ORIGINAL && !user_access('view original images')) {
    return drupal_access_denied();
  }

  if (isset($nid)) {
    $node = node_load(array('type' => 'image', 'nid' => $nid));
    if ($node) {
      if (!node_access('view', $node)) {
        return drupal_access_denied();
      }

      if (isset($node->images[$size])) {
        $file = $node->images[$size];
        $headers = image_file_download($file);
        file_transfer($file, $headers);
      }
    }
  }
  return drupal_not_found();
}


and we want to substitute the call to it by:

$node = node_load(array('type' => 'image', 'nid' => $nid));
$file = $node->images[$size];
header('Location: '.base_path().$file);

probably we need to check for access??

Please review and commit the patch. Seems simple enough.

rsvelko’s picture

Category: support » feature

bump.

jdelaune’s picture

Status: Needs review » Fixed

Patch updated with permission checks and committed to the dev branch.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.