Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
isSameDimension example
return
0;
}
if
(
$media
->
getThumbnails
(
)
=== null
)
{
return
0;
}
$toBeCreatedSizes
=
new
MediaThumbnailSizeCollection
(
$config
->
getMediaThumbnailSizes
(
)
->
getElements
(
)
)
;
$toBeDeletedThumbnails
=
new
MediaThumbnailCollection
(
$media
->
getThumbnails
(
)
->
getElements
(
)
)
;
foreach
(
$toBeCreatedSizes
as
$thumbnailSize
)
{
foreach
(
$toBeDeletedThumbnails
as
$thumbnail
)
{
if
(
!
$this
->
isSameDimension
(
$thumbnail
,
$thumbnailSize
)
)
{
continue
;
}
if
(
$strict
=== true
&& !
$this
->
getFileSystem
(
$media
)
->
fileExists
(
$this
->urlGenerator->
getRelativeThumbnailUrl
(
$media
,
$thumbnail
)
)
)
{
continue
;
}
$toBeDeletedThumbnails
->
remove
(
$thumbnail
->
getId
(
)
)
;
$toBeCreatedSizes
->
remove
(
$thumbnailSize
->
getId
(
)
)
;