Hello,

I am wondering if there is a D7 port planned?

thank you!

Comments

larowlan’s picture

Yes, happy to receive patches.
Shouldn't be that much to change.

manu manu’s picture

Ok, will post a patch if the need of this module is confirmed for the project I am working on.

manu manu’s picture

Title: Imagecache External for Drupal 7? » Imagecache External for Drupal 7
Assigned: Unassigned » manu manu
Status: Active » Needs review
StatusFileSize
new10.46 KB

Okay larowlan,

Here is a patch to port Imagecache External to D7.

I used 6.x-2.0-beta2 as starting point, but I discovered a major design problem: if there is an error fetching an image (no permission, 404), the module sends a drupal_not_found() or drupal_access_denied(), the problem is that happens on the page request on witch we try to display an image (resulting in broken page display), not the image request itself.
I really understand the point to not bootstrap Drupal on each external image request, so I added a theme_imagecache_external() function witch acts as theme_image_style(). If something is wrong, no img tag is returned.

Other points to review:

  • Runned the module thru Coder (witch has done some formating)
  • imagecache_external_generate_path could be renamed to imagecache_external_generate_uri
  • left permission descriptions as TODO
  • Applied $result->Content-Type correction


  • So with this patch, the recommended way to display an external image is:

    <?php 
      print theme('imagecache_external', array('path' => 'http://larsjung.de/h5ai/sample/screenshots/h5ai-v0.7-icons.png', 'style_name'=> 'thumbnail')); 
    ?>
    

    This will return a formated img tag, gaining D7 features:

      <img typeof="foaf:Image" src="http://example.com/sites/default/files/styles/thumbnail/public/imagecache/thumbnail/externals/8d064b159ef9232fbeb533dfa1698a2b/filewkhOsZ" alt="">
    

    See here for a full list of options:
    http://api.drupal.org/api/drupal/modules--image--image.module/function/t...
    http://api.drupal.org/api/drupal/includes--theme.inc/function/theme_image/7

    manu manu’s picture

    oops, did not seen issue #1181232: Prevent image request errors from bubbling up to the entire page. ... Luckily the orientation is the same..

    larowlan’s picture

    Thanks, will try and get to this on the weekend.

    larowlan’s picture

    Status: Needs review » Fixed

    Committed as 7.x-2.x (thanks manu manu)
    Sorry for the delay.
    If we get solid feedback in here, I'll roll an alpha.

    manu manu’s picture

    Version: 6.x-2.0-beta2 » 7.x-2.x-dev

    You're welcome!

    Status: Fixed » Closed (fixed)

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

    13rac1’s picture

    Status: Closed (fixed) » Active

    Can you make a 7.x-2.x release? There isn't one on the project page. Thanks!

    summit’s picture

    Hi There is one on: http://drupal.org/node/975222/release
    Hopefully it is working, thanks for building. Greetings, Martijn

    manu manu’s picture

    Hi,

    the initial port is working quite well but I noticed a problem witch cause images being downloaded multiple times.

    I will open an issue & post a patch as soon as possible, I hope tomorrow

    7wonders’s picture

    Works well for me except if switching to private file system (i see there is a similar issue for d6 version).

    manu manu’s picture

    Here is the issue mentioned in #11:
    #1356648: Images are fetched one time per preset

    davidneedham’s picture

    Status: Active » Closed (fixed)

    Closing per #9, there is a 7.x release now.