Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
[Skip CI] Docs: Images - fixed instructions how to reprocess existing images via background job
Damian Legawiec18174b392bcc
diff --git a/docs/developer/core-concepts/images-assets.mdx b/docs/developer/core-concepts/images-assets.mdxindex 2fc362ad8a..4bbc966022 100644--- a/docs/developer/core-concepts/images-assets.mdx+++ b/docs/developer/core-concepts/images-assets.mdx@@ -209,16 +209,27 @@ end#### Reprocessing Existing Images-After changing variant sizes or upgrading Spree, reprocess existing images:+After changing variant sizes or upgrading Spree, reprocess existing images in background jobs:```ruby-# Reprocess all product images (queues background jobs)Spree::Image.find_each do |image|- next unless image.attached?- image.attachment.preprocess_variants+ next unless image.attachment.attached?++ blob = image.attachment.blob++ %i[mini small medium large xlarge og_image].each do |variant_name|+ transformations = Spree::Image.attachment_reflections['attachment']+ .named_variants[variant_name]+ .transformations++ ActiveStorage::TransformJob.perform_later(blob, transformations)+ endend+```-# Or process synchronously (slower but immediate)+Or process synchronously (slower but immediate)++```rubySpree::Image.find_each do |image|next unless image.attached?[:mini, :small, :medium, :large, :xlarge].each do |variant_name|