Imdb\Title::photo_localurl PHP Method

photo_localurl() public method

Get the URL for the movies cover image
See also: IMDB page / (TitlePage)
public photo_localurl ( boolean $thumb = true ) : mixed
$thumb boolean get the thumbnail (182x268, default) or the bigger variant (400x600 - FALSE)
return mixed url (string URL or FALSE if none)
    public function photo_localurl($thumb = true)
    {
        if ($thumb) {
            $ext = "";
        } else {
            $ext = "_big";
        }
        if (!is_dir($this->photodir)) {
            $this->debug_scalar("<BR>***ERROR*** The configured image directory does not exist!<BR>");
            return false;
        }
        $path = $this->photodir . $this->imdbid() . "{$ext}.jpg";
        if (file_exists($path)) {
            return $this->photoroot . $this->imdbid() . "{$ext}.jpg";
        }
        if (!is_writable($this->photodir)) {
            $this->debug_scalar("<BR>***ERROR*** The configured image directory lacks write permission!<BR>");
            return false;
        }
        if ($this->savephoto($path, $thumb)) {
            return $this->photoroot . $this->imdbid() . "{$ext}.jpg";
        }
        return false;
    }