question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add option to disable downloading of images when using the `gatsby-source-shopify` plugin.

See original GitHub issue

Summary

I’m working on rebuilding an existing Shopify site as a Gatsby site using the gatsby-source-shopify plugin. It has ~600x items, and my internet connection isn’t particularly good, so it can take a very long time for the site the build (even in develop mode). Sometimes the build will fail completely. If sharp tries to transform any of the images it takes even longer and is even less stable.

I think it might be a good idea to add an option to disable downloading the images, as we can still serve the images from Shopify’s CDN. The Shopify CDN will let you resize images using the URL, so the performance is still pretty good. Here is a page with some info on doing this: https://www.shopify.com/partners/blog/img-url-filter

Basic example

plugins: [
  {
    resolve: `gatsby-source-shopify`,
    options: {
      shopName: process.env.SHOPIFY_SHOP_NAME,
      accessToken: accessToken: process.env.SHOPIFY_ACCESS_TOKEN,

      // Whether or not images should be downloaded locally so that they can be
      // transformed by sharp. You might want to disable this for stores with a
      // lot of products
      // Defaults to true
      downloadImage: false,
    },
  },
];

Motivation

Adding this option will make it much easier for people to use this plugin if they have poor internet connections, less powerful computers, or are using it to connect to a store with a large number of images to download.

I plan to attempt to add this myself (along with the help of my friend @mrhut10), but I’ve never written/worked on a Gatsby plugin before, and have limited knowledge of GraphQL outside of using it within Gatsby.

I also wanted to make sure it sounded like a good idea first, and that I’m not overlooking anything before doing the work and submitting a PR only to have it rejected.

If this goes well, I want to also work on a companion plugin to use the images from the Shopify CDN in gatsby-image in much the same way as gatsby-transformer-cloudinary

I’m not sure if this is possible since we need a base64 image as well, but I’ll open a seperate issue for that once I get some feedback on this issue.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mrhut10commented, May 27, 2020

Looks like I can @mrhut10. just removed it.

Looks like you need to yeah tag “not stale” to prevent it automatically being closed by there bots

1reaction
mrhut10commented, May 4, 2020

Yeah from how @lukebennett88 description to me privately if you’ve got 500+ products with 5 images on each products then that’s 2500 images to download them if you try to use them it will then do all the required transformations. This is huge unneeded downloads, storage and processing when Shopify provides a CDN.

The Gatsby-source-sanity plugin I noticed uses the sanity CDN (or optionally cloudinary)

Hope that helps.

@lukebennett88 and I would loved to help make an attempt at a pr to achieve. But certainly open to help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Preventing visitors from downloading your images, videos ...
There isn't a way to completely prevent someone from copying images, video, or audio from your site. Where visitors can right-click and...
Read more >
Block or unblock automatic picture downloads in email ...
Unblock picture downloads for all messages · On the File tab, choose Options > Trust Center. · Under Microsoft Outlook Trust Center, click...
Read more >
How to stop copying and downloading of images
Right-clicking on an image gives users the option to “Save As” or “Set as Background.” There are ways you can disable this ability...
Read more >
4 Ways to Prevent Image Theft in WordPress - WPBeginner
Use Watermark on Your WordPress Images; Disable Hotlinking of Images in WordPress; Add Copyright Notices on Your WordPress Site; How to Check if ......
Read more >
How to Stop Images From Automatically Downloading in Emails
Here's how to disable image loading in Gmail, Apple's Mail app, ... If you are using the Outlook desktop app, go to File...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found