On instagram it is now possible to create posts with multiple images. Currently these multiple image posts are not supported by media_entity_instagram module.

Comments

IT-Cru created an issue. See original summary.

it-cru’s picture

Following error occurs when I try to add an instagram post with multiple images.

Instagram Post with multiple images: https://www.instagram.com/p/BTHtADKFLkm

GuzzleHttp\Exception\ClientException: Client error: `GET https://scontent-fra3-1.cdninstagram.com/t51.2885-15/s612x612/e35/17663356_218115092006899_9184241165346537472_n.jpg` resulted in a `404 Unsupported Size` response: <html> <head> <title>5xx Server Error</title> </head> <body> <h1>5xx Server Error</h1> </body> </html> in GuzzleHttp\Exception\RequestException::create() (line 111 of /vagrant_data/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php).
GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object) (Line: 203)
GuzzleHttp\Promise\Promise::callHandler(1, Object, Array) (Line: 156)
GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}() (Line: 47)
GuzzleHttp\Promise\TaskQueue->run(1) (Line: 246)
GuzzleHttp\Promise\Promise->invokeWaitFn() (Line: 223)
GuzzleHttp\Promise\Promise->waitIfPending() (Line: 267)
GuzzleHttp\Promise\Promise->invokeWaitList() (Line: 225)
GuzzleHttp\Promise\Promise->waitIfPending() (Line: 62)
GuzzleHttp\Promise\Promise->wait() (Line: 129)
GuzzleHttp\Client->request('get', 'https://scontent-fra3-1.cdninstagram.com/t51.2885-15/s612x612/e35/17663356_218115092006899_9184241165346537472_n.jpg', Array) (Line: 87)
GuzzleHttp\Client->__call('get', Array) (Line: 165)
GuzzleHttp\Client->get('https://scontent-fra3-1.cdninstagram.com/t51.2885-15/s612x612/e35/17663356_218115092006899_9184241165346537472_n.jpg') (Line: 165)
Drupal\media_entity_instagram\Plugin\MediaEntity\Type\Instagram->getField(Object, 'thumbnail_local') (Line: 278)
Drupal\media_entity_instagram\Plugin\MediaEntity\Type\Instagram->thumbnail(Object) (Line: 215)
Drupal\media_entity\Entity\Media->automaticallySetThumbnail() (Line: 49)
Drupal\media_entity\Form\MediaInlineForm->entityFormSubmit(Array, Object) (Line: 155)
Drupal\inline_entity_form\Element\InlineEntityForm::submitEntityForm(Array, Object)
call_user_func_array(Array, Array) (Line: 109)
Drupal\inline_entity_form\ElementSubmit::doSubmit(Array, Object) (Line: 102)
Drupal\inline_entity_form\ElementSubmit::doSubmit(Array, Object) (Line: 102)
Drupal\inline_entity_form\ElementSubmit::doSubmit(Array, Object) (Line: 102)
Drupal\inline_entity_form\ElementSubmit::doSubmit(Array, Object) (Line: 102)
Drupal\inline_entity_form\ElementSubmit::doSubmit(Array, Object) (Line: 102)
Drupal\inline_entity_form\ElementSubmit::doSubmit(Array, Object) (Line: 102)
Drupal\inline_entity_form\ElementSubmit::doSubmit(Array, Object) (Line: 102)
Drupal\inline_entity_form\ElementSubmit::doSubmit(Array, Object) (Line: 102)
Drupal\inline_entity_form\ElementSubmit::doSubmit(Array, Object) (Line: 79)
Drupal\inline_entity_form\ElementSubmit::trigger(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 585)
Drupal\Core\Form\FormBuilder->processForm('node_article_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object) (Line: 113)
Drupal\node\Controller\NodeController->add(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 652)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Perhaps this problem only is produced from thumbnail generation.

it-cru’s picture

Problem is the returned instagram 'thumbnail_url' from embed request for multiple images posts. This URL returns always an error.

URL with Error: https://scontent-ams3-1.cdninstagram.com/t51.2885-15/s612x612/e35/176633...

URL without Error: https://scontent-ams3-1.cdninstagram.com/t51.2885-15/e35/17663356_218115...

Instead of using this URL and try to remove size info from URL we grep thumbnail image from direct thumbnail image request with this patch.

Perhaps we should always use this fallback thumbnail image URL for getting our instagram thumbnail images? Size is much smaller then normal images and we need less storage for our thumbnails.

it-cru’s picture

Status: Active » Needs review
chr.fritsch’s picture

StatusFileSize
new675 bytes

I am with you @IT-Cru. We should just always grab the image from these thumbnail url.

I changed it to ?size=m. The images are a little bit larger as ?size=t, but not as big as before.

tjwelde’s picture

Tested. works good.

tjwelde’s picture

Status: Needs review » Reviewed & tested by the community

  • chr.fritsch committed 6cbad85 on 8.x-1.x
    Issue #2866960 by IT-Cru, chr.fritsch: Support for instagram posts with...
chr.fritsch’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed. Thanks everyone

bkosborne’s picture

Hmm why http and not https?

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.