Skip to content
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

Image component - original width and height #5

Closed
wants to merge 8 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
method naming
  • Loading branch information
lpheller committed Nov 3, 2020
commit f8083c6a803019f0dec66ff0135551eb8cd2d463
8 changes: 4 additions & 4 deletions src/Components/ImageComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,16 @@ public function __construct(
$this->conversions = $this->getMediaConversions();
$this->thumbnail = $this->makeThumbnail($image);

$this->width = ($width === 'original') ? $this->originalWidth() : $width;
$this->height = ($height === 'original') ? $this->originalHeight() : $height;
$this->width = ($width === 'original') ? $this->getOriginalWidth() : $width;
$this->height = ($height === 'original') ? $this->getOriginalHeight() : $height;
}

/**
* Get the width of the original image
*
* @return mixed
*/
public function originalWidth()
public function getOriginalWidth()
{
if (file_exists($this->image->getPath())) {
return Image::make($this->image->getPath())->width();
Expand All @@ -122,7 +122,7 @@ public function originalWidth()
*
* @return mixed
*/
public function originalHeight()
public function getOriginalHeight()
{
if (file_exists($this->image->getPath())) {
return Image::make($this->image->getPath())->height();
Expand Down