All our static files are on S3. All bundled images are empty when we export the preview.

Support needs to be added for external images.

CommentFileSizeAuthor
#2 applenews-add-s3-support-2721983-2.patch693 bytesCB
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cbiggins created an issue. See original summary.

CB’s picture

Status: Active » Needs review
FileSize
693 bytes

Patch attached. As a last resort when adding an image asset, check that if it can be accessed remotely.

brianfisher’s picture

Does this work yet? As of February external images were not supported.

brianfisher’s picture

Category: Task » Feature request
Status: Needs review » Postponed (maintainer needs more info)
brianfisher’s picture

Title: Add S3 support » External image support
CB’s picture

Yep, works for me.

brianfisher’s picture

Ah I see you're caching the files locally... does the existing code fail for s3?

CB’s picture

Existing code provided 42b empty gifs. I couldn't get it to work at all with our files.

This is not utilising local cache, this is calling the image directly from S3. $uri is the direct url (the arg is called uri and I just left it)

brianfisher’s picture

What I mean is we are caching the file in the local file system, prior to adding it to the bundle.

This works generally for external images -- question is why is it failing in your case.

Can you provide a publicly available url that fails, but your patch fixes?

CB’s picture

@tbfisher I'll try and post it here.

Tabestan’s picture

Hi, I get the same issue. I adapted the patch for 7.x-2.x-dev but I still cannot preview an article.

When clicking on preview, I get

Warning: scandir(/32076): failed to open dir: No such file or directory in ApplenewsPreview->scanDirectory() (line 143 of /var/www/docroot/sites/all/modules/contrib/applenews/include/preview.inc).
Warning: scandir(): (errno 2): No such file or directory in ApplenewsPreview->scanDirectory() (line 143 of /var/www/docroot/sites/all/modules/contrib/applenews/include/preview.inc).
Warning: array_filter() expects parameter 1 to be array, boolean given in ApplenewsPreview->scanDirectory() (line 145 of /var/www/docroot/sites/all/modules/contrib/applenews/include/preview.inc).
Warning: array_values() expects parameter 1 to be array, null given in ApplenewsPreview->scanDirectory() (line 145 of /var/www/docroot/sites/all/modules/contrib/applenews/include/preview.inc).
Warning: Invalid argument supplied for foreach() in ApplenewsPreview->createArchive() (line 216 of /var/www/docroot/sites/all/modules/contrib/applenews/include/preview.inc).
Warning: ZipArchive::close(): Can't remove file: No such file or directory in ApplenewsPreview->createArchive() (line 245 of /var/www/docroot/sites/all/modules/contrib/applenews/include/preview.inc).
Warning: file_get_contents(/32076.zip): failed to open stream: No such file or directory in applenews_download_article_json() (line 1156 of /var/www/docroot/sites/all/modules/contrib/applenews/applenews.admin.inc).