Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
image or poster adding
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Support

2022-10-07 23:06:26
This code here overrides any poster added if you visit the torrents-details page of that specific torrent, even if you add a image yourself. This happens when the OMDB scrape does not have an image for the torrent. Can anyone help with an if/else or empty that if an image is already present, it will not overwrite it?
          if (($imdb_image = $TTIMDB->getImage_1($_data->Poster, $site_config['torrent_dir'] . "/images/", $id))) {
           SQL_Query_exec("UPDATE `torrents` SET `image1` = '" . $imdb_image . "' WHERE `id` = $id");
 }


Probably this right?
          if (empty($imdb_image = $TTIMDB->getImage_1($_data->Poster, $site_config['torrent_dir'] . "/images/", $id))) {
           SQL_Query_exec("UPDATE `torrents` SET `image1` = '" . $imdb_image . "' WHERE `id` = $id");
 }

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Last edited by MicroMonkey on 2022-10-08 01:06:23
2022-10-08 06:28:10
That should work in theory but it depends what $TTIMDB->getImage_1 returns  -  find the cache file and edit poster manually and echo both results I assume empty cache returns  string 0 ("") and true returns string url

Ideally you won't use that function and use the cache

Not a fan of over riding / updating good data  especially if user uploaded

This is what I did pass the torrent row and tmdb row to a function and flip though

My codes different but a rough idea - I just checked it's not a empty string - the paths needs to be clearer $img = etc
wrote this on phone lol
function getimage($row, $_data)
   {
       if ( $row["imdb"] != '' && $_data["poster"]  !='') {
           $img =  $_data["poster"];
       } elseif ($row["tmdb"] != ''&& $_data["poster"]  !='') {
           $img =  $_data["poster"];
       } elseif ($row["image1"] != '') {
$img = $row["image1"];
       } elseif ($row["image2"] != '') {
$img = $row["image2"];
       } else {
           $img = "assets/images/misc/default_avatar.webp";
       }

       return $img;
   }
Last edited by M-jay warn on 2022-10-08 08:00:45
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 2
  • Members: 0
  • Guests online: 2
  • Comments: 3
  • Messages: 1,728