It seems to me that imagecache_external_generate_path() either returns a filepath string, or returns a FieldItemList object depending on if the image was called externally or if we have the image already. I think the following code:

    if ($needs_refresh === FALSE) {
      return $filepath;
    }
    elseif ($filepath = imagecache_external_fetch($url, $directory . '/' . $filename)) {
      return $filepath;
    }

should be...

    if ($needs_refresh === FALSE) {
      return $filepath;
    }
    elseif ($filepath = imagecache_external_fetch($url, $directory . '/' . $filename)) {
      return $filepath->getString();
    }

Can you please confirm? I think your module handles it later on, but Im calling this function directly in some custom code and the return is inconsistent.

CommentFileSizeAuthor
#4 2973305-4.patch1.12 KBBarisW
#2 2973305-1.patch435 byteswilleaton

Comments

willeaton created an issue. See original summary.

willeaton’s picture

Status: Active » Needs review
StatusFileSize
new435 bytes

Attaching a patch for this, without this patch, no images are rendered the first time round, only on the second.

willeaton’s picture

Hi, is anyone maintaining this module?

BarisW’s picture

StatusFileSize
new1.12 KB

Sorry for the delay in responding. I believe that you're right in that imagecache_external_generate_path() returns inconsistent data. The reason for this is that imagecache_external_fetch() returned $file->uri instead of $file->getFileUri();

I changed this, would you be so kind to test this with your custom code and let me know if this fixes your problem?

willeaton’s picture

Ok but it will be a few weeks before I can go back on to that project

achap’s picture

I had the same issue. Patch #4 fixed it for me.

achap’s picture

Status: Needs review » Reviewed & tested by the community
BarisW’s picture

Thanks for the review!

  • BarisW committed 901b9b0 on 8.x-1.x
    Issue #2973305 by willeaton, BarisW, achap:...
BarisW’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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