Skip to main content
GET
/
photo
/
:
/
transcode
PlexPHP
declare(strict_types=1);

require 'vendor/autoload.php';

use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;

$sdk = Plex_API\PlexAPI::builder()
    ->setSecurity(
        '<YOUR_API_KEY_HERE>'
    )
    ->build();

$request = new Operations\GetResizedPhotoRequest(
    width: 110,
    height: 165,
    blur: 0,
    minSize: Operations\MinSize::Zero,
    upscale: Operations\Upscale::Zero,
    url: '/library/metadata/49564/thumb/1654258204',
);

$response = $sdk->server->getResizedPhoto(
    request: $request
);

if ($response->statusCode === 200) {
    // handle response
}
This response does not have an example.

Authorizations

X-Plex-Token
string
header
required

The token which identifies the user accessing the PMS. This can be either:

  • A traditional access token obtained from plex.tv
  • A JWT token obtained through the JWT authentication flow

JWT tokens provide better security with:

  • Short-lived tokens (7 days expiration)
  • Public-key cryptography (ED25519)
  • Better clock synchronization
  • Individual device revocation capability

Headers

accepts
enum<string>
default:application/xml

Indicates the client accepts the indicated media types

Available options:
application/json,
application/xml
X-Plex-Client-Identifier
string
required

An opaque identifier unique to the client

Example:

"abc123"

X-Plex-Product
string

The name of the client product

Example:

"Plex for Roku"

X-Plex-Version
string

The version of the client application

Example:

"2.4.1"

X-Plex-Platform
string

The platform of the client

Example:

"Roku"

X-Plex-Platform-Version
string

The version of the platform

Example:

"4.3 build 1057"

X-Plex-Device
string

A relatively friendly name for the client device

Example:

"Roku 3"

X-Plex-Model
string

A potentially less friendly identifier for the device model

Example:

"4200X"

X-Plex-Device-Vendor
string

The device vendor

Example:

"Roku"

X-Plex-Device-Name
string

A friendly name for the client

Example:

"Living Room TV"

X-Plex-Marketplace
string

The marketplace on which the client application is distributed

Example:

"googlePlay"

Query Parameters

url
string

The source URL for the image to transcode. Note, if this URL requires a token such as X-Plex-Token, it should be given as a query parameter to this url.

format
enum<string>

The output format for the image; defaults to jpg

Available options:
jpg,
jpeg,
png,
ppm
width
integer

The desired width of the output image

height
integer

The desired height of the output image

quality
integer

The desired quality of the output. -1 means the highest quality. Defaults to -1

Required range: -1 <= x <= 127
background
string

The background color to apply before painting the image. Only really applicable if image has transparency. Defaults to none

upscale
enum<integer>

Indicates if image should be upscaled to the desired width/height. Defaults to false

Available options:
0,
1
minSize
enum<integer>

Indicates if image should be scaled to fit the smaller dimension. By default (false) the image is scaled to fit within the width/height specified but if this parameter is true, it will allow overflowing one dimension to fit the other. Essentially it is making the width/height minimum sizes of the image or sizing the image to fill the entire width/height even if it overflows one dimension.

Available options:
0,
1
rotate
enum<integer>

Obey the rotation values specified in EXIF data. Defaults to true.

Available options:
0,
1
blur
integer

Apply a blur to the image, Defaults to 0 (none)

saturation
integer

Scale the image saturation by the specified percentage. Defaults to 100

Required range: 0 <= x <= 100
opacity
integer

Render the image at the specified opacity percentage. Defaults to 100

Required range: 0 <= x <= 100
chromaSubsampling
enum<integer>

Use the specified chroma subsambling.

  • 0: 411
  • 1: 420
  • 2: 422
  • 3: 444 Defaults to 3 (444)
Available options:
0,
1,
2,
3
blendColor
string

The color to blend with the image. Defaults to none

Response

The resulting image

The response is of type file.