class RemoteImage extends Image implements Arrayable, JsonSerializable, StorableFile

Traits

Properties

string|null $name from  File
string|null $mime from  File
protected array<string, string>|SerializableClosure $headers from  File
protected array<string, mixed>|SerializableClosure $providerOptions from  File
protected Response|null $response from  HasRemoteContent

Methods

static File|null
fromArray(array $data)

Reconstruct a file instance from its array representation.

from  File
static string
value(array $data, string $key, string $type)

Get a required value from the file representation.

from  File
string|null
name()

Get the displayable name of the file.

as(string|null $name)

Set the displayable name of the file.

from  File
withHeaders(array|Closure $headers)

Specify HTTP headers for the file upload. Closures may only capture serializable values.

from  File
withProviderOptions(array|Closure $options)

Specify provider-specific options for the file upload. Closures may only capture serializable values.

from  File
array
providerOptions(Lab|string $provider)

Get the provider-specific options for the file upload.

from  File
array
headers(Lab|string $provider)

Get the HTTP headers for the file upload.

from  File
string|null
mimeType()

Get the file's MIME type.

withMimeType(string $mimeType)

Set the file's MIME type.

from  File
static Base64Image
fromBase64(string $base64, string|null $mimeType = null)

Create a new image from Base64 data.

from  Image
static ProviderImage
fromId(string $id)

Create a new provider image using the image with the given ID.

from  Image
static LocalImage
fromPath(string $path, string|null $mimeType = null)

Create a new image using the image at the given path.

from  Image
static RemoteImage
fromUrl(string $url)

Create a new remote image using the image at the given URL.

from  Image
static StoredImage
fromStorage(string $path, string|null $disk = null)

Create a new stored image using the image at the given path on the given disk.

from  Image
static Base64Image
fromUpload(UploadedFile $file, string|null $mimeType = null)

Create a new Base64 image using the given file upload.

from  Image
put(string|null $mimeType = null, string|null $name = null, Provider|Lab|string|null $provider = null)

Store the file on a given provider.

string
content()

Get the raw representation of the file.

string|null
declaredMimeType()

Get the declared MIME type without fetching the remote resource.

response()

Get the HTTP response for the remote file.

array
__serialize()

Prepare the file for serialization, discarding the cached HTTP response so it can be fetched again.

string
__toString()

Get the file content as a string.

__construct(string $url, string|null $mimeType = null)

Create a new remote image.

array
toArray()

Get the instance as an array.

array
jsonSerialize()

Get the JSON serializable representation of the instance.

Details

in File at line 29
static File|null fromArray(array $data)

Reconstruct a file instance from its array representation.

Parameters

array $data

Return Value

File|null

in File at line 70
static protected string value(array $data, string $key, string $type)

Get a required value from the file representation.

Parameters

array $data
string $key
string $type

Return Value

string

in HasRemoteContent at line 26
string|null name()

Get the displayable name of the file.

Return Value

string|null

in File at line 90
HasName as(string|null $name)

Set the displayable name of the file.

Parameters

string|null $name

Return Value

HasName

in File at line 102
File withHeaders(array|Closure $headers)

Specify HTTP headers for the file upload. Closures may only capture serializable values.

Parameters

array|Closure $headers

Return Value

File

in File at line 116
File withProviderOptions(array|Closure $options)

Specify provider-specific options for the file upload. Closures may only capture serializable values.

Parameters

array|Closure $options

Return Value

File

in File at line 130
array providerOptions(Lab|string $provider)

Get the provider-specific options for the file upload.

Parameters

Lab|string $provider

Return Value

array

in File at line 142
array headers(Lab|string $provider)

Get the HTTP headers for the file upload.

Parameters

Lab|string $provider

Return Value

array

in HasRemoteContent at line 36
string|null mimeType()

Get the file's MIME type.

Return Value

string|null

in File at line 160
File withMimeType(string $mimeType)

Set the file's MIME type.

Parameters

string $mimeType

Return Value

File

in Image at line 14
static Base64Image fromBase64(string $base64, string|null $mimeType = null)

Create a new image from Base64 data.

Parameters

string $base64
string|null $mimeType

Return Value

Base64Image

in Image at line 22
static ProviderImage fromId(string $id)

Create a new provider image using the image with the given ID.

Parameters

string $id

Return Value

ProviderImage

in Image at line 30
static LocalImage fromPath(string $path, string|null $mimeType = null)

Create a new image using the image at the given path.

Parameters

string $path
string|null $mimeType

Return Value

LocalImage

in Image at line 38
static RemoteImage fromUrl(string $url)

Create a new remote image using the image at the given URL.

Parameters

string $url

Return Value

RemoteImage

in Image at line 46
static StoredImage fromStorage(string $path, string|null $disk = null)

Create a new stored image using the image at the given path on the given disk.

Parameters

string $path
string|null $disk

Return Value

StoredImage

in Image at line 54
static Base64Image fromUpload(UploadedFile $file, string|null $mimeType = null)

Create a new Base64 image using the given file upload.

Parameters

UploadedFile $file
string|null $mimeType

Return Value

Base64Image

StoredFileResponse put(string|null $mimeType = null, string|null $name = null, Provider|Lab|string|null $provider = null)

Store the file on a given provider.

Parameters

string|null $mimeType
string|null $name
Provider|Lab|string|null $provider

Return Value

StoredFileResponse

in HasRemoteContent at line 18
string content()

Get the raw representation of the file.

Return Value

string

in HasRemoteContent at line 44
string|null declaredMimeType()

Get the declared MIME type without fetching the remote resource.

Return Value

string|null

in HasRemoteContent at line 52
protected Response response()

Get the HTTP response for the remote file.

Return Value

Response

in HasRemoteContent at line 60
array __serialize()

Prepare the file for serialization, discarding the cached HTTP response so it can be fetched again.

Return Value

array

in HasRemoteContent at line 72
string __toString()

Get the file content as a string.

Return Value

string

at line 22
__construct(string $url, string|null $mimeType = null)

Create a new remote image.

Parameters

string $url
string|null $mimeType

at line 34
array toArray()

Get the instance as an array.

Return Value

array

at line 47
array jsonSerialize()

Get the JSON serializable representation of the instance.

Return Value

array