Skip to content

armgit / spree

Public Imported from GitHub
0

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.

Merge branch 'main' into feature/v-3109-bug-blog-attaching-images-to-posts-via-the-text-editor

Szymon Chorobskid8d4ee1ce112
diff --cc core/app/helpers/spree/images_helper.rb
index 9e285732ed,d968743ec0..858a072290
--- a/core/app/helpers/spree/images_helper.rb
+++ b/core/app/helpers/spree/images_helper.rb
@@@ -15,17 -15,18 +15,19 @@@ module Spre
end
def spree_image_url(image, options = {})
++ return unless image
++ return unless image.variable?
++ return if image.respond_to?(:attached?) && !image.attached?
++
+ url_helpers = respond_to?(:main_app) ? main_app : Rails.application.routes.url_helpers
width = options[:width]
height = options[:height]
- width = width * 2 if width.present?
- height = height * 2 if height.present?
-
- return unless image&.attached?
- return unless image&.variable?
+ width *= 2 if width.present?
+ height *= 2 if height.present?
- return if image.respond_to?(:attached?) && !image.attached?
- return unless image.variable?
-
if width.present? && height.present?
- main_app.cdn_image_url(
+ url_helpers.cdn_image_url(
image.variant(spree_image_variant_options(resize_to_fill: [width, height]))
)
else