image.php 795 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. require_once("user.php");
  3. $image_url = $_GET['img'];
  4. $image_height = $_GET['height'];
  5. $image_width = $_GET['width'];
  6. $urlCheck = stripos(PLEXURL, "http");
  7. if ($urlCheck === false) {
  8. $plexAddress = "http://" . PLEXURL;
  9. }else{
  10. $plexAddress = PLEXURL;
  11. }
  12. if(PLEXPORT !== ""){ $plexAddress = $plexAddress . ":" . PLEXPORT; }
  13. //$plexAddress = PLEXURL.':'.PLEXPORT;
  14. $addressPosition = strpos($image_url, $plexAddress);
  15. if($addressPosition !== false && $addressPosition == 0) {
  16. $image_src = $plexAddress . '/photo/:/transcode?height='.$image_height.'&width='.$image_width.'&upscale=1&url=' . $image_url . '&X-Plex-Token=' . PLEXTOKEN;
  17. header('Content-type: image/jpeg');
  18. readfile($image_src);
  19. } else {
  20. echo "Bad Plex Image Url";
  21. }