From 63dadca79c461ad5a9be6cac4fe72a2f29d74da2 Mon Sep 17 00:00:00 2001 From: Rhuan Carlos Date: Tue, 10 Apr 2018 08:56:52 -0300 Subject: [PATCH 1/2] SQUARE images, not resized proportional --- src/InstagramScraper/Model/Media.php | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/InstagramScraper/Model/Media.php b/src/InstagramScraper/Model/Media.php index 6edc7886..b5ea34c1 100644 --- a/src/InstagramScraper/Model/Media.php +++ b/src/InstagramScraper/Model/Media.php @@ -63,7 +63,7 @@ class Media extends AbstractModel /** * @var array */ - protected $squareThumbnailsUrl = []; + protected $squareImages = []; /** * @var array @@ -277,9 +277,9 @@ public function getImageHighResolutionUrl() /** * @return array */ - public function getSquareThumbnailsUrl() + public function getSquareImages() { - return $this->squareThumbnailsUrl; + return $this->squareImages; } @@ -449,23 +449,26 @@ protected function initPropertiesCustom($value, $prop, $arr) $this->likesCount = $arr[$prop]['count']; break; case 'display_resources': - foreach ($value as $thumbnail) { - $thumbnailsUrl[] = $thumbnail['src']; - switch ($thumbnail['config_width']) { + foreach ($value as $media) { + $mediasUrl[] = $media['src']; + switch ($media['config_width']) { case 640: - $this->imageThumbnailUrl = $thumbnail['src']; + $this->imageThumbnailUrl = $media['src']; break; case 750: - $this->imageLowResolutionUrl = $thumbnail['src']; + $this->imageLowResolutionUrl = $media['src']; break; case 1080: - $this->imageStandardResolutionUrl = $thumbnail['src']; + $this->imageStandardResolutionUrl = $media['src']; break; - default: - ; } } - $this->squareThumbnailsUrl = $thumbnailsUrl; + break; + case 'thumbnail_resources': + foreach ($value as $thumbnail) { + $thumbnailsUrl[] = $thumbnail['src']; + } + $this->squareImages = $thumbnailsUrl; break; case 'display_url': $this->imageHighResolutionUrl = $value; From e92441ed91a20c220354bf4b0fa507e98382f584 Mon Sep 17 00:00:00 2001 From: Rhuan Carlos Date: Tue, 10 Apr 2018 09:00:26 -0300 Subject: [PATCH 2/2] renamed --- src/InstagramScraper/Model/Media.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/InstagramScraper/Model/Media.php b/src/InstagramScraper/Model/Media.php index b5ea34c1..74f18a5b 100644 --- a/src/InstagramScraper/Model/Media.php +++ b/src/InstagramScraper/Model/Media.php @@ -465,10 +465,11 @@ protected function initPropertiesCustom($value, $prop, $arr) } break; case 'thumbnail_resources': - foreach ($value as $thumbnail) { - $thumbnailsUrl[] = $thumbnail['src']; + $squareImagesUrl = []; + foreach ($value as $squareImage) { + $squareImagesUrl[] = $squareImage['src']; } - $this->squareImages = $thumbnailsUrl; + $this->squareImages = $squareImagesUrl; break; case 'display_url': $this->imageHighResolutionUrl = $value;