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

square images url, not resized proportional #332

Merged
merged 2 commits into from
Apr 23, 2018
Merged
Changes from all commits
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
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