I don't know how exactly to explain that, but i'm creating a class, which uses the TMDB Class as support for getting movie information. The code is:
<?php
class MovInfo
{
const API_KEY = 'apikey';
public $tmdb;
function __construct(){
include 'config.php';
include 'TMDb.php';
$this->tmbd = new TMDb(MovInfo::API_KEY);
}
public function objectToArray($object)
{
if (!is_object($object) && !is_array($object)) {
return $object;
}
if (is_object($object)) {
$object = get_object_vars($object);
}
return array_map('objectToArray', $object);
}
public function getCover($id){
$images = $this->tmdb->getImages($id);
$img = $this->objectToArray(json_decode($images));
return $img[0]['posters'][2]['image']['url'];
}
}
?>
At this part of the code:
$images = $this->tmdb->getImages($id);
Returns the error:
Fatal error: Call to a member function getImages() on a non-object in /opt/lampp/htdocs/get.php on line 25
I don't know what's wrong, how should i call this function.
Thank you.


Sign In
Create Account

Back to top









