Skip to content

Commit

Permalink
Merge pull request #332 from rhcarlosweb/feature/squareimages
Browse files Browse the repository at this point in the history
square images url, not resized proportional
  • Loading branch information
raiym authored Apr 23, 2018
2 parents 817932a + e92441e commit 7afc32b
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/InstagramScraper/Model/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class Media extends AbstractModel
/**
* @var array
*/
protected $squareThumbnailsUrl = [];
protected $squareImages = [];

/**
* @var array
Expand Down Expand Up @@ -277,9 +277,9 @@ public function getImageHighResolutionUrl()
/**
* @return array
*/
public function getSquareThumbnailsUrl()
public function getSquareImages()
{
return $this->squareThumbnailsUrl;
return $this->squareImages;
}


Expand Down Expand Up @@ -449,23 +449,27 @@ 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':
$squareImagesUrl = [];
foreach ($value as $squareImage) {
$squareImagesUrl[] = $squareImage['src'];
}
$this->squareImages = $squareImagesUrl;
break;
case 'display_url':
$this->imageHighResolutionUrl = $value;
Expand Down

0 comments on commit 7afc32b

Please sign in to comment.