Skip to content

Commit

Permalink
Merge branch 'v3' of https://github.com/craftcms/cms into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
#	src/image/Raster.php
  • Loading branch information
brandonkelly committed Feb 2, 2023
2 parents 771e0f0 + 6013779 commit e183807
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- Fixed a bug where `craft\services\Assets::getAllDescendantFolders()` could return unexpected results for folders that contained an underscore.
- Fixed a bug where accessing a custom field’s magic property on an element would return the field’s raw database value rather than `null`, if it didn’t belong to the element’s field layout anymore. ([#12539](https://github.com/craftcms/cms/issues/12539), [#12578](https://github.com/craftcms/cms/pull/12578))
- Fixed a bug where previewing an asset could wipe out all `h1` tags within Redactor fields. ([#12545](https://github.com/craftcms/cms/issues/12545))
- Fixed a bug where `craft\image\Raster::getIsTransparent()` wasn’t working. ([#12565](https://github.com/craftcms/cms/issues/12565))
- Added `craft\helpers\Db::escapeForLike()`.
- `craft\services\Assets::getAllDescendantFolders()` now has a `$withParent` argument, which can be passed `false` to omit the parent folder from the results. ([#12536](https://github.com/craftcms/cms/issues/12536))
- Deprecated `craft\helpers\DateTimeHelper::timeZoneAbbreviation()`.
Expand Down
9 changes: 7 additions & 2 deletions src/image/Raster.php
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,13 @@ public function loadFromSVG(string $svgContent): self
*/
public function getIsTransparent(): bool
{
if (Craft::$app->getImages()->getIsImagick() && method_exists(Imagick::class, 'getImageAlphaChannel')) {
return $this->_image->getImagick()->getImageAlphaChannel();
if (Craft::$app->getImages()->getIsImagick()) {
// https://github.com/php-imagine/Imagine/issues/842#issuecomment-1402748019
$alphaRange = $this->_image->getImagick()->getImageChannelRange(Imagick::CHANNEL_ALPHA);
return (
isset($alphaRange['minima'], $alphaRange['maxima']) &&
$alphaRange['minima'] < $alphaRange['maxima']
);
}

return false;
Expand Down

0 comments on commit e183807

Please sign in to comment.