1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

poster image path for themoviedb.org

Discussion in 'PHP' started by Prorockz, Dec 16, 2017.

  1. #1
    hello guys.

    need some help. im using a cms php script for movie website.

    there is 2 way to show poster on website front. 1: upload poster by self. 2: show direct link from the https://image.tmdb.org

    i want to show direct link from https://image.tmdb.org

    in this script when we grab data from tmdb.org it also grab poster image and background image. poster image is show in admincp .. but on public website. poster image not show but background image worked fine.

    admincp (file name get_movie_details.php) : image code used. this one.
    SEMrush
        if (isset($data['poster_path'])){
            $curl = new Curl();
        $image_data = "https://image.tmdb.org/t/p/original/".$data['poster_path'];
    
            if ($image_data){
                $image_name = "movie_".md5($title.$imdb_id);
    
        $thumbaaa = "https://image.tmdb.org/t/p/original/".$data['poster_path'];
          copy($thumbaaa,"../../thumbs/".$image_name.".jpg");
    
    
    
         $ch3 = curl_init();
    
        curl_setopt($ch3, CURLOPT_URL, "https://api.themoviedb.org/3/movie/".$imdb_id."/images?api_key=a742865b6ff6cebe98285acf713d234e");
        curl_setopt($ch3, CURLOPT_RETURNTRANSFER, TRUE);
        curl_setopt($ch3, CURLOPT_HEADER, FALSE);
            curl_setopt($ch3, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($ch3, CURLOPT_SSL_VERIFYHOST, 0);
    
    curl_setopt($ch3, CURLOPT_HTTPHEADER, array(
      "Accept: application/json"
    ));
    
        $response3 = curl_exec($ch3);
        curl_close($ch3);
        $data3 = json_decode($response3,true);
    $backdrops = $data3['backdrops'];
    
    
        $backdrops1 = "https://image.tmdb.org/t/p/original/".$backdrops[1]['file_path'];
    
    copy($backdrops1,"../../thumbs/fanart_movie".$imdb_id.".jpg");
    
    
                $ret['image'] = $image_name.".jpg";
            } else {
                $ret['image'] = "0";
            }
        }
    
    
        print(json_encode($ret));
    } else {
        print("0");
    }
    Code (markup):
    and for to template in file watchmovie.php used code this

    $ch3 = curl_init();
    
        curl_setopt($ch3, CURLOPT_URL, "http://api.themoviedb.org/3/movie/".$mov['imdb_id']."/images?api_key=a742865b6ff6cebe98285acf713d234e");
        curl_setopt($ch3, CURLOPT_RETURNTRANSFER, TRUE);
        curl_setopt($ch3, CURLOPT_HEADER, FALSE);
            curl_setopt($ch3, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($ch3, CURLOPT_SSL_VERIFYHOST, 0);
    
    curl_setopt($ch3, CURLOPT_HTTPHEADER, array(
      "Accept: application/json"
    ));
    
        $response3 = curl_exec($ch3);
        curl_close($ch3);
        $data3 = json_decode($response3,true);
    $backdrops = $data3['backdrops'];
    
    
    
        $backdrops1 = "http://image.tmdb.org/t/p/original".$backdrops[1]['file_path'];
       
        $backdrops2 = "http://image.tmdb.org/t/p/original".$backdrops[2]['file_path'];
       
        $backdrops3 = "http://image.tmdb.org/t/p/original/3".$backdrops[3]['backdrops'];
       
    
      $smarty->assign("backdrops1",$backdrops1);
    
      $smarty->assign("backdrops2",$backdrops2);
    
      $smarty->assign("backdrops3",$backdrops3);
    Code (markup):
    now in the file watchmovie.php this code are missing.

        if (isset($data['poster_path'])){
            $curl = new Curl();
        $image_data = "https://image.tmdb.org/t/p/original/".$data['poster_path'];
    
            if ($image_data){
                $image_name = "movie_".md5($title.$imdb_id);
    
        $thumbaaa = "https://image.tmdb.org/t/p/original/".$data['poster_path'];
          copy($thumbaaa,"../../thumbs/".$image_name.".jpg");
    Code (markup):
    when im copy and past this code in watchmovie.php website get close cant open.
    please can someone tell me how to add this code in watchmovie.php ..

    both file in zip folder are attached.

    sorry im not good in it. hope u understand me
    when compare both file code u will know what im asking.
    thanks alot
     

    Attached Files:

    Prorockz, Dec 16, 2017 IP
    SEMrush