Limit enterprise image sizes on DFC API

Uploaded images can be several MB in size. While offering the big size
would enable other apps to resize it and store the image size they need,
we have only one app using it in practice and it's using the image
directly. It's much simpler and if a default size will work for others
in the future then why not just serve that.

We can revise this in the future. There is a DFC discussion about
publishing several sizes which I started:
https://github.com/datafoodconsortium/ontology/discussions/77#discussioncomment-8228094
This commit is contained in:
Maikel Linke
2024-03-19 12:18:52 +11:00
parent acb53a6ddc
commit 526069dbb3
2 changed files with 4 additions and 4 deletions

View File

@@ -29,8 +29,8 @@ class EnterpriseBuilder < DfcBuilder
# But that would require a new endpoint for a single string.
add_ofn_property(e, "ofn:contact_name", enterprise.contact_name)
add_ofn_property(e, "ofn:logo_url", enterprise.logo.url)
add_ofn_property(e, "ofn:promo_image_url", enterprise.promo_image.url)
add_ofn_property(e, "ofn:logo_url", enterprise.logo_url(:small))
add_ofn_property(e, "ofn:promo_image_url", enterprise.promo_image_url(:large))
end
end

View File

@@ -377,8 +377,8 @@ paths:
dfc-b:supplies: http://test.host/api/dfc/enterprises/10000/supplied_products/10001
ofn:long_description: "<p>Hello, world!</p><p>This is a paragraph.</p>"
ofn:contact_name: Fred Farmer
ofn:logo_url: http://www.example.com/rails/active_storage/url/logo.png
ofn:promo_image_url: http://www.example.com/rails/active_storage/url/promo.png
ofn:logo_url: http://test.host/rails/active_storage/url/logo.png
ofn:promo_image_url: http://test.host/rails/active_storage/url/promo.png
dfc-b:affiliates: http://test.host/api/dfc/enterprise_groups/60000
- "@id": http://test.host/api/dfc/addresses/40000
"@type": dfc-b:Address