image.php 715 B

1234567891011121314151617181920212223242526272829303132333435
  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. if(isset($image_url) && isset($image_height) && isset($image_width)) {
  14. $image_src = $plexAddress . '/photo/:/transcode?height='.$image_height.'&width='.$image_width.'&upscale=1&url=' . $image_url . '&X-Plex-Token=' . PLEXTOKEN;
  15. header('Content-type: image/jpeg');
  16. readfile($image_src);
  17. } else {
  18. echo "Invalid Plex Request";
  19. }