Skip to content

Commit

Permalink
[framework] handle image resizing by image proxy (#2924)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitek-rostislav authored Dec 7, 2023
2 parents 63f9d4d + 4b6295b commit 68be196
Show file tree
Hide file tree
Showing 272 changed files with 1,399 additions and 3,624 deletions.
5 changes: 5 additions & 0 deletions app/.env
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ TRUSTED_PROXIES=127.0.0.1
# When you do not want to use CDN, it is used value '//' as workaround by https://github.com/symfony/symfony/issues/28391
CDN_DOMAIN=//
# CDN_DOMAIN=http://127.0.0.1:8001 # uncomment this line if you want to test CDN locally
CDN_API_KEY=''
CDN_API_SALT=''

GOPAY_IS_PRODUCTION_MODE=false
GOPAY_EN_GOID=
Expand Down Expand Up @@ -72,3 +74,6 @@ SENTRY_ENVIRONMENT=
SENTRY_RELEASE=

FORCE_ELASTIC_LIMITS=false

IMG_PROXY_INTERNAL_URL='http://img-proxy:8080'
WEBSERVER_INTERNAL_URL='http://webserver:8080'
2 changes: 1 addition & 1 deletion app/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"scheb/2fa-qr-code": "^5.7",
"sensio/framework-extra-bundle": "^5.2",
"sentry/sentry-symfony": "^4.2.8",
"shopsys/deployment": "~1.1.0",
"shopsys/deployment": "~2.0.0",
"shopsys/form-types-bundle": "14.0.x-dev",
"shopsys/framework": "14.0.x-dev",
"shopsys/frontend-api": "14.0.x-dev",
Expand Down
10 changes: 2 additions & 8 deletions app/config/graphql/types/ModelType/Advert/AdvertImage.types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,16 @@ AdvertImage:
images:
type: "[Image!]!"
description: "Advert images"
resolve: '@=query("imagesByAdvertPromiseQuery", value, args["type"], args["sizes"])'
resolve: '@=query("imagesByAdvertPromiseQuery", value, args["type"])'
args:
type:
type: "String"
defaultValue: null
sizes:
type: "[String!]"
defaultValue: null
mainImage:
type: "Image"
description: "Adverts first image by params"
resolve: '@=query("mainImageByAdvertPromiseQuery", value, args["type"], args["size"])'
resolve: '@=query("mainImageByAdvertPromiseQuery", value, args["type"])'
args:
type:
type: "String"
defaultValue: null
size:
type: "String"
defaultValue: null
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,16 @@ BlogArticle:
images:
type: "[Image!]!"
description: "Blog article images"
resolve: '@=query("imagesByBlogArticlePromiseQuery", value, args["type"], args["sizes"])'
resolve: '@=query("imagesByBlogArticlePromiseQuery", value, args["type"])'
args:
type:
type: "String"
defaultValue: null
sizes:
type: "[String!]"
defaultValue: null
mainImage:
type: "Image"
description: "Blog article image by params"
resolve: '@=query("mainImageByBlogArticlePromiseQuery", value, args["type"], args["size"])'
resolve: '@=query("mainImageByBlogArticlePromiseQuery", value, args["type"])'
args:
type:
type: "String"
defaultValue: null
size:
type: "String"
defaultValue: null
10 changes: 2 additions & 8 deletions app/config/graphql/types/ModelType/Category/Category.types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,11 @@ Category:
images:
type: "[Image!]!"
description: "Category images"
resolve: '@=query("imagesByCategoryOrReadyCategorySeoMixPromiseQuery", value, args["type"], args["sizes"])'
resolve: '@=query("imagesByCategoryOrReadyCategorySeoMixPromiseQuery", value, args["type"])'
args:
type:
type: "String"
defaultValue: null
sizes:
type: "[String!]"
defaultValue: null
products:
type: "ProductConnection!"
description: "Paginated and ordered products of category"
Expand All @@ -65,11 +62,8 @@ Category:
mainImage:
type: "Image"
description: "Category image by params"
resolve: '@=query("mainImageByCategoryOrReadyCategorySeoMixPromiseQuery", value, args["type"], args["size"])'
resolve: '@=query("mainImageByCategoryOrReadyCategorySeoMixPromiseQuery", value, args["type"])'
args:
type:
type: "String"
defaultValue: null
size:
type: "String"
defaultValue: null
55 changes: 2 additions & 53 deletions app/config/graphql/types/ModelType/Image/Image.types.yaml
Original file line number Diff line number Diff line change
@@ -1,55 +1,4 @@
Image:
type: object
config:
description: "Represents an image"
fields:
name:
type: "String"
description: "Image name for ALT attribute"
position:
type: "Int"
description: "Position of image in list"
type:
type: "String"
description: "Image type"
sizes:
type: "[ImageSize!]!"

ImageSize:
type: object
config:
description: "Represents a single image size"
fields:
size:
type: "String!"
description: "Image size defined in images.yaml"
url:
type: "String!"
description: "URL address of image"
width:
type: "Int"
description: "Width in pixels defined in images.yaml"
height:
type: "Int"
description: "Height in pixels defined in images.yaml"
additionalSizes:
type: "[AdditionalSize!]!"
description: "Additional sizes for different screen types"

AdditionalSize:
type: object
config:
description: "Represents a singe additional image size"
fields:
url:
type: "String!"
description: "URL address of image"
width:
type: "Int"
description: "Width in pixels defined in images.yaml"
height:
type: "Int"
description: "Height in pixels defined in images.yaml"
media:
type: "String!"
description: "Recommended media query defined in images.yaml"
inherits:
- 'ImageDecorator'
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,16 @@ NotificationBar:
images:
type: "[Image!]!"
description: "Notification bar images"
resolve: '@=query("imagesByEntityPromiseQuery", value, args["type"], args["sizes"])'
resolve: '@=query("imagesByEntityPromiseQuery", value, args["type"])'
args:
type:
type: "String"
defaultValue: null
sizes:
type: "[String!]"
defaultValue: null
mainImage:
type: "Image"
description: "Notification bar image by params"
resolve: '@=query("mainImageByEntityPromiseQuery", value, args["type"], args["size"])'
resolve: '@=query("mainImageByEntityPromiseQuery", value, args["type"])'
args:
type:
type: "String"
defaultValue: null
size:
type: "String"
defaultValue: null
10 changes: 2 additions & 8 deletions app/config/graphql/types/ModelType/Payment/Payment.types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,16 @@ Payment:
images:
type: "[Image!]!"
description: "Payment images"
resolve: '@=query("imagesByEntityPromiseQuery", value, args["type"], args["sizes"])'
resolve: '@=query("imagesByEntityPromiseQuery", value, args["type"])'
args:
type:
type: "String"
defaultValue: null
sizes:
type: "[String!]"
defaultValue: null
mainImage:
type: "Image"
description: "Payment image by params"
resolve: '@=query("mainImageByEntityPromiseQuery", value, args["type"], args["size"])'
resolve: '@=query("mainImageByEntityPromiseQuery", value, args["type"])'
args:
type:
type: "String"
defaultValue: null
size:
type: "String"
defaultValue: null
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,19 @@ Brand:
images:
type: "[Image!]!"
description: "Brand images"
resolve: '@=query("imagesByEntityPromiseQuery", value, args["type"], args["sizes"])'
resolve: '@=query("imagesByEntityPromiseQuery", value, args["type"])'
args:
type:
type: "String"
defaultValue: null
sizes:
type: "[String!]"
defaultValue: null
mainImage:
type: "Image"
description: "Brand image by params"
resolve: '@=query("mainImageByEntityPromiseQuery", value, args["type"], args["size"])'
resolve: '@=query("mainImageByEntityPromiseQuery", value, args["type"])'
args:
type:
type: "String"
defaultValue: null
size:
type: "String"
defaultValue: null
slug:
type: "String!"
description: "Brand URL slug"
Expand Down
10 changes: 2 additions & 8 deletions app/config/graphql/types/ModelType/Product/Product.types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,11 @@ Product:
images:
type: "[Image!]!"
description: "Product images"
resolve: '@=query("imagesByProductPromiseQuery", value, args["type"], args["sizes"])'
resolve: '@=query("imagesByProductPromiseQuery", value, args["type"])'
args:
type:
type: "String"
defaultValue: null
sizes:
type: "[String!]"
defaultValue: null
price:
type: "ProductPrice!"
description: "Product price"
Expand All @@ -79,14 +76,11 @@ Product:
mainImage:
type: "Image"
description: "Product image by params"
resolve: '@=query("mainImageByProductPromiseQuery", value, args["type"], args["size"])'
resolve: '@=query("mainImageByProductPromiseQuery", value, args["type"])'
args:
type:
type: "String"
defaultValue: null
size:
type: "String"
defaultValue: null
isMainVariant:
type: "Boolean!"
productVideos:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,4 @@ SeoPage:
ogImage:
type: "Image"
description: "Image for og image meta tag by params"
resolve: '@=query("ogImageBySeoPageQuery", value, args["size"])'
args:
size:
type: "String"
defaultValue: null
resolve: '@=query("ogImageBySeoPageQuery", value)'
10 changes: 2 additions & 8 deletions app/config/graphql/types/ModelType/Slider/SliderItem.types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,16 @@ SliderItem:
images:
type: "[Image!]!"
description: "Slider item images"
resolve: '@=query("imagesByEntityPromiseQuery", value, args["type"], args["sizes"])'
resolve: '@=query("imagesByEntityPromiseQuery", value, args["type"])'
args:
type:
type: "String"
defaultValue: null
sizes:
type: "[String!]"
defaultValue: null
mainImage:
type: "Image"
description: "Slider item image by params"
resolve: '@=query("mainImageByEntityPromiseQuery", value, args["type"], args["size"])'
resolve: '@=query("mainImageByEntityPromiseQuery", value, args["type"])'
args:
type:
type: "String"
defaultValue: null
size:
type: "String"
defaultValue: null
5 changes: 1 addition & 4 deletions app/config/graphql/types/ModelType/Store/Store.types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,8 @@ Store:
images:
type: "[Image!]!"
description: "Store images"
resolve: '@=query("imagesByStorePromiseQuery", value, args["type"], args["sizes"])'
resolve: '@=query("imagesByStorePromiseQuery", value, args["type"])'
args:
type:
type: "String"
defaultValue: null
sizes:
type: "[String!]"
defaultValue: null
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,19 @@ Transport:
images:
type: "[Image!]!"
description: "Transport images"
resolve: '@=query("imagesByEntityPromiseQuery", value, args["type"], args["sizes"])'
resolve: '@=query("imagesByEntityPromiseQuery", value, args["type"])'
args:
type:
type: "String"
defaultValue: null
sizes:
type: "[String!]"
defaultValue: null
mainImage:
type: "Image"
description: "Transport image by params"
resolve: '@=query("mainImageByEntityPromiseQuery", value, args["type"], args["size"])'
resolve: '@=query("mainImageByEntityPromiseQuery", value, args["type"])'
args:
type:
type: "String"
defaultValue: null
size:
type: "String"
defaultValue: null
isPersonalPickup:
type: "Boolean!"
description: "Pointer telling if the transport is of type personal pickup"
Loading

0 comments on commit 68be196

Please sign in to comment.