-
-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Mediafinder dimensions #958
base: develop
Are you sure you want to change the base?
Conversation
if ($itemType === MediaLibraryItem::TYPE_FILE) { | ||
$imageDimensions = getimagesize($this->getStorageDisk()->path($item['path'])); | ||
$dimensions = "$imageDimensions[0] x $imageDimensions[1]"; | ||
} else { | ||
$dimensions = null; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TYPE_FILE
would also include videos, audio, etc.
It this could be limited by only applying this logic to $item->getFileType() === MediaLibraryItem::FILE_TYPE_IMAGE
, however that will not be available until after the MediaLibraryItem
has been inited.
* @param int $size | ||
* @param int $lastModified | ||
* @param string $type | ||
* @param string $publicUrl | ||
*/ | ||
public function __construct($path, $size, $lastModified, $type, $publicUrl) | ||
public function __construct($path, $dimensions, $size, $lastModified, $type, $publicUrl) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be passing this as the last argument for maximum BC, and since it's only relevant to specific types of media items we should start moving towards metadata support, so the parameter should actually be array $metadata
and contain 'dimensions'
as a an array with 'width'
and 'height'
values.
* folders dimensions is always NULL. | ||
*/ | ||
if ($itemType === MediaLibraryItem::TYPE_FILE) { | ||
$imageDimensions = getimagesize($this->getStorageDisk()->path($item['path'])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work for files stored on disks that aren't the local disk.
This pull request will be closed and archived in 3 days, as there has been no activity in this pull request for the last 6 months. |
This PR adds the dimensions to an image in the Mediafinder