Product photos from Google Drive (CavaliERP)
Some ERPs cannot hold pictures. They carry only the file names of a product’s photos, and the pictures live in a Google Drive folder that your team keeps adding to. For a store linked to CavaliERP, the CavaliERP screen has a Product photos from Google Drive card that closes that gap: it reads the file names the ERP lists, finds the matching files in your Drive folder, and fills the product galleries in the ERP’s order.
It needs the settings.manage permission, like the rest of the CavaliERP screen.
How a photo is matched
Section titled “How a photo is matched”- The ERP lists up to six photos per product: a main photo and photos 2 to 6. That order is the gallery order.
- A photo name is the Drive file name without its extension. The ERP’s
Harvard Detail 1matches the fileHarvard Detail 1.jpg. Case, extra spaces and accents do not matter;Harvard-JRmatchesharvard-jr.JPG. - Only a real image extension is dropped. In
Bergamo Set #5.2the dot is part of the name, so it matchesBergamo Set #5.2.jpg. - The whole folder is read, including every sub-folder, so a new delivery folder needs no setup. Only files whose name an ERP photo uses are ever picked up; everything else in the folder is ignored.
- If several files have the same name, the sync never picks one for you. The file a gallery already uses stays unless you choose another; otherwise every candidate (up to eight) is offered in Changes waiting for approval, with a preview of each, and you choose. The Drive’s own “modified” and “created” times are chosen by whoever uploads a file, so they never decide anything. A candidate you rejected is not offered again for that photo; the next one is.
- A colour is its own product with its own photo names, so each colour gets its own gallery.
What you set up
Section titled “What you set up”The card has a folder, a key and three switches. Everything starts off, with dry run on.
| Setting | What it does |
|---|---|
| Drive folder | The folder to read. Paste its link or its ID; every sub-folder is read. |
| Access key | A Google API key (for a folder shared with “anyone with the link”), or a service-account JSON key for a folder that is not. It is stored encrypted and never shown again; the card only says whether one is stored. |
| Fetch photos from Drive | Turns the source on for your store. Needs the folder and a key. The platform itself must also have the Drive source switched on; if it has not, the card says it is not available yet. |
| Dry run | Reads the Drive and reports what would be added. No product gallery is changed. Turn it off to let the sync write. |
| Offer replaced photos for approval | When a photo in Drive is edited, or another file appears under the same name as one already in a gallery, it is only offered in the approval list. Nothing in a gallery changes until you approve it. Off by default; turning it on asks you to confirm. |
Run now starts a pass at once (within a minute); otherwise the folder is read about every 30 minutes. Re-read the whole folder also looks again at files that did not change, which is how a file removed from Drive is noticed.
A very large folder is read in several passes. When the last scans did not reach every folder, the card says so (“The last N scans did not reach every folder”): a gap in the report may then be a folder that has not been read yet. The next runs continue where they stopped, and nothing is concluded about files that were not reached.
The card always carries a note that everything in the folder is untrusted: a folder shared by link can have been written to by anyone who has the link, and the card does not (and cannot) check who may edit it. That is why no picture from the Drive becomes public without you approving that exact content (see “What the sync does, and never does”). A very large or hostile folder cannot slow the sync for everyone: each photo name keeps a bounded number of files, the whole folder has a file cap, and rows for files that left the Drive long ago are deleted unless a gallery refers to them. When a name has more files in the Drive than the index keeps, or a folder was cut short by the per-folder file limit, the card lists them by name (“Names with more files than the index keeps”, “Folders cut short”): the genuine file may be among the ignored ones, so clean the Drive folder.
How to share the folder
Section titled “How to share the folder”Whoever has the folder’s link can use it. For a folder shared with “anyone with the link”, we recommend the Viewer role and not Editor: the sync only reads, and a Viewer link cannot be used to change or add files. A service-account key lets you keep the folder private instead, shared only with that account. This is advice, not a check the platform makes: approval of the exact content is what keeps the shop safe either way.
What the sync does, and never does
Section titled “What the sync does, and never does”- One rule: no picture from the Drive becomes public until an admin approved that exact content.
- A draft with no gallery gets one only when every photo the ERP lists exists in Drive, so a gallery is never half-built. Until then the product waits and the report names what is missing. The photos the sync puts into a draft are not reviewed, and an unreviewed photo is hidden from the storefront: it is created hidden, in the same step that adds it to the gallery, and every public reader skips it (the storefront, collections, search, feeds and exports, structured data, the catalog pull’s “has an image” check). A product whose only photos are waiting therefore behaves exactly like a product with no photos: the catalog pull, a scheduled publish, a bulk publish or an import cannot put an unreviewed picture on sale. The product is listed under Drive photos to review, the product page shows a warning while photos wait, and the catalog pull also waits for the review. You still see the photos in the admin, marked as waiting. The sync itself never publishes.
- For a product that is on sale, nothing from the Drive is stored on its own: each file for an empty gallery or a new photo slot waits in Changes waiting for approval, because a folder anyone can write to could otherwise put someone else’s picture on a live product.
- A gallery the sync created is brought up to date: a photo the ERP adds later is added, and the ERP’s order is restored.
- A change to a photo that is already in a gallery is never made on the Drive’s say-so. It waits in Changes waiting for approval, with a preview, the file’s name and folder, when it changed, and the first characters of the current and the offered file’s hash. After you approve it, the next run stores the new image first and then removes the old one. The approval is for exactly that file and content: it records a SHA-256 of the bytes you decided on, so if the file changes again before the run (even to something with the same short hash) the approval no longer applies and the new version is offered instead. A change you rejected is never offered again, but it never hides another candidate for the same photo.
- A copy of a product (Duplicate) does not copy a photo that is still waiting for a review, and an image that is waiting cannot be added to another product from the media library until it was reviewed.
- You approve what you saw: the preview is made from the bytes the platform downloaded, and the approval records the SHA-256 of exactly those bytes. At the run the file is downloaded again and compared; if it differs, nothing is stored and a new offer replaces the old one.
- If the same picture simply appears under a new Drive file (the original was moved or archived), the sync follows it without asking, because the content is identical.
- A gallery you edited by hand is never changed. It is only reported.
- Nothing is ever deleted because a file disappeared from Drive or because the ERP stopped listing a photo.
- A product’s status is never changed: a draft that receives its photos stays a draft, and publishing is yours.
- A file is accepted only if its content really is a JPEG, PNG or WebP within the size and pixel limits, whatever its name says. Files go through the same upload path as pictures you add yourself.
Reading the reports
Section titled “Reading the reports”- Last run shows the newest run: its status, whether it was a dry run, and a one-line summary. The full report of every run is in the run list on the same screen (the job is called Drive photos).
- Drive photos to review lists the products whose gallery holds photos waiting for a review (a draft or a product on sale), with a small image of each photo. The pictures are loaded on this screen, and Approve photos is available for a product only once every picture of it has loaded: the request names each photo together with the hash of the picture that loaded, and the platform releases a photo only while it still has exactly that hash. A photo that changed (or arrived) since you looked is not approved; the screen says how many, and you look again. Approve all shown approves the photos whose pictures loaded on the screen (for the first rollout, which can be about a hundred drafts), nothing else. Not this one removes a photo and remembers the file, so the next file under that name is offered; a file you reject again and again after it was edited is no longer offered at all. A photo you removed by hand leaves the list by itself.
- When some proposals did not fit in the approval queue (the queue is limited, and so is the share of one product), the card says how many and the run report lists the products: decide some, or clean up the Drive folder.
- Changes waiting for approval lists each offered change with TWO small images side by side: what the gallery shows now (“Now in the gallery”; a new photo shows “No image yet”) and what the Drive offers (“Offered”). Both are made by the platform (the file is decoded and saved again small), never the Drive’s own file.
- Photo gaps shows, for each product, the photo names the ERP lists, which of them were found in Drive, and how many images the product shows. It also lists Drive files no photo name uses, names that appear more than once, and files that were refused. The photo names are recorded on every catalog pull, so this report is useful even before any Drive access is set up.
A safe order for switching it on
Section titled “A safe order for switching it on”- Run a catalog pull so the ERP’s photo names are recorded, and read Photo gaps.
- Save the folder and a key, keep Dry run on, and turn the source on.
- Choose Run now and read the run report and Photo gaps.
- When the report is what you expect, turn Dry run off. The next run fills the draft galleries.
- Open Drive photos to review, look at the pictures and approve them. Only then do they appear on the storefront and can the catalog pull publish the product.
- Turn Offer replaced photos for approval on when you want edited or newer files offered to you.
Removing the key turns the source off. Images already added stay.