Skip to main content

Gallery

The Gallery is SnapCart's media library — a central place to upload, organise, and reuse images and files across products, blog posts, CMS pages, and banners. Go to Gallery in the left sidebar.

Gallery Media Library Gallery showing uploaded files as a grid of thumbnails with file names and sizes

The gallery displays all uploaded files as a grid of thumbnails. Each thumbnail shows:

  • A preview of the image (or a file-type icon for non-image files such as PDFs)
  • The file name below the thumbnail
  • The file size in kilobytes or megabytes

Filtering and searching:

  • Use the search bar (top of the grid) to find files by name. The search is case-insensitive and matches partial file names.
  • Use the file type filter dropdown to narrow the view to Images, Documents, or All Files.
  • Files are sorted by upload date — newest first — by default. You can switch to alphabetical order using the sort dropdown.

Click any thumbnail to open the file detail panel on the right side of the screen, which shows the full file name, dimensions (for images), size, upload date, and a direct URL.

Uploading Files

Single file upload

  1. Click Upload (top-right corner).
  2. In the file picker that opens, select a file from your computer.
  3. The file uploads immediately and appears at the top of the gallery grid.

Bulk upload

  1. Click Upload.
  2. In the file picker, hold Ctrl (Windows/Linux) or Cmd (macOS) and click multiple files to select them all at once, or hold Shift to select a range.
  3. Click Open. All selected files upload in parallel.
  4. A progress indicator shows the upload status for each file.

Alternatively, drag and drop one or more files directly onto the gallery grid area. The grid highlights with a drop-zone border when you drag files over it.

File requirements

PropertyLimit / Supported Values
Maximum file size5 MB per file
Supported image formatsJPEG, PNG, WebP, GIF, SVG
Supported document formatsPDF
Minimum dimensionsNo minimum enforced, but see recommended sizes below

Files that exceed 5 MB are rejected with an error. Compress large images before uploading using a tool such as Squoosh, TinyPNG, or ImageOptim.

Using correctly-sized images prevents layout shifts, slow page loads, and blurry rendering. The table below lists the recommended pixel dimensions for each common use case.

ContextRecommended SizeAspect RatioFormat Notes
Product main image800 × 800 px1:1 (square)JPEG at 80% quality or WebP for best compression
Product gallery images800 × 800 px1:1 (square)Match the main image dimensions for a consistent gallery
Category image / card600 × 400 px3:2JPEG or WebP
Homepage hero banner1920 × 600 px16:5JPEG, full-width slideshow
Blog featured image1200 × 628 px~1.91:1Optimised for social sharing (Open Graph)
Brand logo200 × 80 pxLandscapePNG with transparent background
Favicon32 × 32 px1:1PNG or ICO; upload via Settings → General
CMS page image800 × 450 px16:9JPEG or WebP
Coupon / promotional banner1200 × 300 px4:1JPEG
tip

WebP format offers 25–35% smaller file sizes compared to JPEG at equivalent quality. Use WebP for all new uploads where browser compatibility is not a concern. All major browsers have supported WebP since 2020.

When you need to attach an image to any content type, you do not upload separately — you select from the gallery.

  1. In the product, blog post, or page editor, click the image field or Select from Gallery button.
  2. The gallery picker modal opens, showing the full media library with the same search and filter controls.
  3. Browse or search for the image you need.
  4. Click the image thumbnail to select it. A checkmark overlay confirms the selection.
  5. Click Confirm. The image is attached to the content field.

Embedding images in rich-text content

Inside the rich-text editor (for blog posts, CMS pages, or product descriptions):

  1. Position your cursor where you want the image.
  2. Click the Image button in the editor toolbar (picture icon).
  3. The gallery picker opens.
  4. Select an image and click Confirm.
  5. The image is embedded inline. Click the image in the editor to resize it or set alignment (left, centre, right).

Renaming Files

The gallery does not currently support in-place file renaming after upload. To rename a file:

  1. Download the file, rename it on your local machine using the correct naming convention.
  2. Delete the old file from the gallery (see the deletion section below).
  3. Upload the renamed file.
  4. Reassign the new file to any products, pages, or posts that used the old file.

To avoid this workflow, name files correctly before uploading (see Best Practices below).

Copying an Image URL

  1. Click a thumbnail to open the file detail panel.
  2. The File URL field shows the full public URL of the image.
  3. Click the Copy icon next to the URL field to copy it to your clipboard.

Use this URL to reference the image in custom HTML widgets, email templates, or external systems.

Deleting Files

  1. Click a thumbnail to open the file detail panel.
  2. Click Delete.
  3. Confirm the deletion in the prompt.
caution

Deleting a file from the gallery does not automatically remove it from products, pages, or posts that reference it. Those content items will display a broken image icon on the storefront. Before deleting any file, search for its usage:

  • Check the Used In field in the file detail panel (if shown).
  • Search the product and page lists for references to that file name.
  • Replace the image on all content items before deleting.

Storage Backends

SnapCart supports two storage modes, configured in application.yml:

ModeSettingDescription
Localstorage.type: localFiles stored in /storage/ on the server filesystem. Suitable for development and single-server deployments.
AWS S3storage.type: s3Files stored in an S3-compatible bucket. Suitable for production, multi-server, and cloud deployments.

For production deployments, AWS S3 (or a compatible service such as DigitalOcean Spaces, Cloudflare R2, or MinIO) is strongly recommended for:

  • Durability: S3-compatible services replicate data across multiple availability zones.
  • Scalability: No server disk space limitations.
  • CDN delivery: Pair S3 with a CDN (see below) for fast global delivery.

Switching from local to S3

Update application.yml with your S3 credentials and bucket details, then restart the application. Existing locally-stored files must be manually migrated to the bucket — the application does not migrate them automatically.

CDN Delivery

When S3 storage is active, you can front the bucket with a CDN (Content Delivery Network) such as Amazon CloudFront, Cloudflare, or BunnyCDN for faster image delivery to globally distributed customers.

To enable CDN delivery:

  1. Create a CDN distribution pointing to your S3 bucket as the origin.
  2. In application.yml, set storage.cdn-url to your CDN base URL (e.g., https://cdn.yourstore.com).
  3. Restart the application. All new image URLs generated by SnapCart will use the CDN domain instead of the S3 bucket URL.

Images served via CDN are cached at edge nodes geographically close to the customer, reducing load times for product images significantly.

Best Practices for Image Naming

Consistent, descriptive file names make the gallery easier to search and improve SEO (image file names are a minor ranking signal).

GuidelineGood ExampleBad Example
Use lowercase letters onlynike-air-max-90-red.jpgNike_Air_Max_90_Red.jpg
Separate words with hyphenssamsung-galaxy-s24-ultra.webpsamsunggalaxys24ultra.webp
Include the product name and variantadidas-ultraboost-23-white-side.jpgIMG_0042.jpg
Include the context/angle for product imagesapple-iphone-15-pro-titanium-front.webpphoto1.webp
Keep names concise (under 60 characters)levi-501-jeans-blue-32x30.jpglevis-original-501-straight-fit-jeans-indigo-blue-32-inch-waist-30-inch-leg.jpg
Do not include dates or version numbershero-banner-summer.jpghero-banner-2024-06-15-v3.jpg

Troubleshooting

Upload fails immediately without a clear error. The file likely exceeds the 5 MB limit or is in an unsupported format. Check the file size and format in your operating system's file properties. Compress or convert the file before retrying.

Images upload successfully but do not appear on the storefront. If using local storage, verify that the /storage/ directory is web-accessible (correctly mapped in your Nginx or Apache configuration). If using S3, verify that the bucket policy allows public read access for object URLs, or that a pre-signed URL strategy is correctly configured.

Gallery search returns no results for a file I know exists. The search matches file names exactly. If the file was uploaded with a generic name (e.g., image.jpg), it may be hard to locate — browse the grid by scrolling instead, or sort by date to find recently uploaded files.

Broken images are appearing on the storefront after I deleted a file. Deleted gallery files are not replaced automatically. Go to each affected product, page, or blog post and upload or select a replacement image. Use the gallery's copy URL feature to identify which content referenced the deleted file.