Get poster from OMDb Poster API

@param string $imdbid
@param integer $height
@return string
773615
public function poster($imdbid, $height = 300)
    {
        if (is_null($this->api_key)) {
            return $this->output('400', 'No API Key Found');
        }

        if ($this->validateIMDBid($imdbid) == false) {
            return $this->output('400', 'Invalid IMDB ID provided');
        }

        if (!is_numeric($height)) {
            return $this->output('400', 'Height should be numeric');
        }

        if ($height < 1 && $height > 1000) {
            return $this->output('400', 'Height should be between 1-1000');
        }

        $api_uri = '?i=' . $imdbid . '&h=' . $height . '&apikey=' . $this->api_key;
        $output  = $this->get($api_uri);

        if ($output->code === 200) {
            header("Content-Type: image/jpeg");
            return $output->data;
        }

        return $output;
    }
356644
public function actionShow($id, $width = null, $height = null)
    {
        $model = $this->findModel($id);
        $response = Yii::$app->getResponse();
        if ($width === null && $height === null) {
            return $response->sendFile($model->filename, $model->name, [
                    'mimeType' => $model->type,
                    'fileSize' => $model->size,
                    'inline' => true
            ]);
        } else {
            $dir = '';
            if ($width !== null) {
                $dir .= 'w' . (int) $width;
            }
            if ($height !== null) {
                $dir .= 'h' . (int) $height;
            }
            $filename = sprintf('%s/%s/%x/%d_%s', Yii::getAlias($this->savePath), $dir, $id % 255, $id, $model->name);
            if (!file_exists($filename)) {
                FileHelper::createDirectory(dirname($filename));
                $image = Image::thumbnail($model->filename, $width, $height);
                $image->save($filename);
            }
            return $response->sendFile($filename, $model->name, [
                    'mimeType' => $model->type,
                    'inline' => true
            ]);
        }
    }
378269
public function thumbnailAction($storageId, $height, $width)
    {
        $fileManager = $this->get('beaast.core.manager.file');

        /**
         * @var File $file
         */
        $file = $fileManager->findOneBy(['storageId' => $storageId]);

        if (!$file || !in_array($file->getExtension(), ['jpg', 'png', 'gif'], true)) {
            throw $this->createNotFoundException();
        }

        $filePath = $fileManager->getFilePath($file);

        $cacheFileName = 'thumbnail_'.$height.'_'.$width.'_'.$storageId.'.'.$file->getExtension();

        $cacheFilePath = $this->getParameter('kernel.root_dir').'/../var/storage/cache/'.$cacheFileName;
        if (!file_exists($cacheFilePath) && file_exists($filePath)) {
            $imagick = new \Imagick($filePath);
            $imagick->thumbnailImage($width, $height, true);
            file_put_contents($cacheFilePath, $imagick->getImageBlob());
        }

        return $this->cacheAction($cacheFileName);
    }
1092636
public function getById($layoutId)
    {
        $record = LayoutRecord::findOne(['id' => $layoutId]);

        if ($record) {
            return new LayoutModel($record->getAttributes());
        }

        return null;
    }
314483
protected function urlForSize($width, $height=null)
    {

        if (!$this->sizes) {
            return $this->getUrl();
        }

        $targetSize = $width instanceof Size ? $width : new Size($width, $height);
        $targetKey = "$targetSize";

        if (isset($this->optimalSizeCache[$targetKey])) {
            return $this->optimalSizeCache[$targetKey];
        }

        $optimalSize = $targetSize->findBest($this->sizes());

        if ($this->getSize()->equals($optimalSize)) {
            $this->optimalSizeCache[$targetKey] = $this->getUrl();
            return $this->optimalSizeCache[$targetKey];
        }

        $optimalKey = "$optimalSize";

        if (isset($this->sizeUrls[$optimalKey])) {
            $this->optimalSizeCache[$targetKey] = $this->sizeUrls[$optimalKey];
            return $this->optimalSizeCache[$targetKey];
        }

        return $this->getUrl();

    }
442982
public function ThumbnailURL($width, $height)
    {
        $object = $this->getObjectLatestVersion();
        if ($object instanceof Thumbnail) {
            return $object->ThumbnailURL($width, $height);
        }
        return null;
    }
789507
public function show($id)
    {
        $apiRequest = RequestFactory::create();

        $resource = new GetResource(
            $this->serializer,
            $apiRequest->getFields(),
            $apiRequest->getIncludedRelationships()
        );

        $find = $this->findResourceCallable($id);

        return $this->addHeaders($resource->get($id, get_class($this->getDataModel()), $find));
    }
432673
static public function fetchRelatedObjectsID( $objectID, $attributeID, $allRelations)
    {
        if ( !is_array( $allRelations ) || $allRelations === array() )
        {
            $allRelations = array( 'common', 'xml_embed', 'attribute' );
            if ( eZContentObject::isObjectRelationTyped() )
            {
                $allRelations[] = 'xml_link';
            }
        }

        $relatedObjectsTyped = array();
        foreach ( $allRelations as $relationType )
        {
            $relatedObjectsTyped[$relationType] =
                eZContentFunctionCollection::fetchRelatedObjects( $objectID, $attributeID, array( $relationType ), false, array() );
        }

        $relatedObjectsTypedIDArray = array();
        foreach ( $relatedObjectsTyped as $relationTypeName => $relatedObjectsByType )
        {
            $relatedObjectsTypedIDArray[$relationTypeName] = array();
            foreach ( $relatedObjectsByType['result'] as $relatedObjectByType )
            {
                $relatedObjectsTypedIDArray[$relationTypeName][] = $relatedObjectByType->ID;
            }
        }

        return array( 'result' => $relatedObjectsTypedIDArray );
    }
156636
public function getInvoicePdf($accountID, $invoiceID)
    {
        return $this->httpHelper->get("accounts/" . intval($accountID) . "/invoices/" . intval($invoiceID) . "/pdf");
    }
1299454
public function getHtml($nodeId, $level)
    {
        $node = $this->nodes[$nodeId];
        $storeId = $this->_storeManager->getStore()->getId();

        if (isset($this->content[$node->getContent()])) {
            $content = $this->content[$node->getContent()];
            $content = $this->filterProvider->getBlockFilter()->setStoreId($storeId)->filter($content);

            return $content;
        }

        return '';
    }
1112775
public function getPoster($sSize = 'small', $bDownload = true)
        {
            if (true === $this->isReady) {
                $sMatch = IMDBHelper::matchRegex($this->sSource, self::IMDB_POSTER, 1);

                if (false !== $sMatch) {
                    if ('big' === strtolower($sSize) && false !== strstr($sMatch, '@._')) {
                        $sMatch = substr($sMatch, 0, strpos($sMatch, '@._')) . '@.jpg';
                    }

                    if (false === $bDownload) {
                        return IMDBHelper::cleanString($sMatch);
                    } else {
                        $sLocal = IMDBHelper::saveImage($sMatch, $this->iId);
                        if (file_exists($sLocal)) {
                            return $sLocal;
                        } else {
                            return $sMatch;
                        }
                    }
                }
            }

            return $this->sNotFound;
        }
1082670
public function getURL($width = '', $height = '')
    {
        $uri = $this->getName();
        if ($height && $width) {
            return Settings::get('image_url').$width.'/'.$height.'/'.$uri;
        } elseif ($width) {
            return Settings::get('image_url').$width.'/'.$uri;
        } else { // original image
            return Settings::get('image_url').$uri;
        }
    }
410113
public function getAlbumPhotos($albumId, $page = 1)
    {
        if (is_null($albumId) || $albumId == '') {
            throw new Exception('The albumId is required to get the list of photos in the album.');
        }

        $params = array(
            'method' => 'sp.album.get_photos',
            'album_id' => $albumId,
            'page' => $page
        );

        return $this->_makeApiRequest($params);
    }
949548
public static function getByID($arLayoutColumnID)
    {
        $db = Loader::db();
        $row = $db->GetRow('select * from AreaLayoutThemeGridColumns where arLayoutColumnID = ?', array($arLayoutColumnID));
        if (is_array($row) && $row['arLayoutColumnID']) {
            $al = new static();
            $al->loadBasicInformation($arLayoutColumnID);
            $al->setPropertiesFromArray($row);

            return $al;
        }
    }
1181232
protected function getTargetDimensions($width, $height, $originalImagePath)
    {
        $originalDimensions = [$width, $height];

        try {
            $dimensions = getimagesize($originalImagePath);
            if (!$dimensions) {
                return $originalDimensions;
            }

            if ($dimensions[0] > $width || $dimensions[1] > $height) {
                return $originalDimensions;
            }

            return $dimensions;
        }
        catch (Exception $ex) {
            return $originalDimensions;
        }
    }
561331
public function getMovies($id, array $parameters = [], array $headers = [])
    {
        return $this->createMovieCollection(
            $this->getApi()->getMovies($id, $this->parseQueryParameters($parameters), $headers)
        );
    }
679929
public function resizeExec(?string $id, int $height, int $width)
    {
        $data = [
            'h' => $height,
            'w' => $width,
        ];

        $url = self::$base_url.'/exec'.($id ?? $this->container_id).'/resize?'.http_build_query($data);

        return self::$curl->post($url);
    }