SourceResource
extends SourceCustom
in package
This class holds a pointer to a VipsObject (the libvips base class) and manages properties.
Table of Contents
Properties
- $check_max_stack_size : bool
- libvips executes FFI callbacks off the main thread and this confuses the stack limit checks available since PHP 8.3.0. We need to check if `zend.max_allowed_stack_size` is set to `-1`.
- $resource : resource
Methods
- __clone() : mixed
- __construct() : mixed
- The resource passed in will become "owned" by this class.
- __destruct() : mixed
- filename() : string|null
- Get the filename associated with a connection. Return null if there is no associated file.
- get() : mixed
- getArgumentDescription() : string
- getBlurb() : string
- getDescription() : string
- getPspec() : CData|null
- getType() : int
- newFromDescriptor() : self
- Make a new source from a file descriptor. For example:
- newFromFile() : self
- Make a new source from a filename. For example:
- newFromMemory() : self
- Make a new source from a memory buffer. For example:
- nick() : string|null
- Make a human-readable name for a connection suitable for error messages.
- onRead() : void
- Attach a read handler.
- onSeek() : void
- Attach a seek handler.
- printAll() : void
- ref() : void
- set() : void
- setString() : bool
- signalConnect() : void
- Connect to a signal on this object.
- unref() : void
- unrefOutputs() : void
- getMarshaler() : Closure|null
Properties
$check_max_stack_size
libvips executes FFI callbacks off the main thread and this confuses the stack limit checks available since PHP 8.3.0. We need to check if `zend.max_allowed_stack_size` is set to `-1`.
private
static bool
$check_max_stack_size
= true
See: https://github.com/libvips/php-vips/pull/237.
$resource
private
resource
$resource
Methods
__clone()
public
__clone() : mixed
__construct()
The resource passed in will become "owned" by this class.
public
__construct(resource $resource) : mixed
On destruction of this class, the resource will be closed.
Parameters
- $resource : resource
__destruct()
public
__destruct() : mixed
filename()
Get the filename associated with a connection. Return null if there is no associated file.
public
filename() : string|null
Return values
string|nullget()
public
get(string $name) : mixed
Parameters
- $name : string
Tags
getArgumentDescription()
public
getArgumentDescription(string $name) : string
Parameters
- $name : string
Return values
stringgetBlurb()
public
getBlurb(string $name) : string
Parameters
- $name : string
Return values
stringgetDescription()
public
getDescription() : string
Return values
stringgetPspec()
public
getPspec(string $name) : CData|null
Parameters
- $name : string
Return values
CData|nullgetType()
public
getType(string $name) : int
Parameters
- $name : string
Return values
intnewFromDescriptor()
Make a new source from a file descriptor. For example:
public
static newFromDescriptor(int $descriptor) : self
$source = Source::newFromDescriptor(0);
Makes a descriptor attached to stdin. You can pass this source to (for example) @see Image::newFromSource()
Parameters
- $descriptor : int
Tags
Return values
selfnewFromFile()
Make a new source from a filename. For example:
public
static newFromFile(string $filename) : self
$source = Source::newFromFile("myfile.jpg");
You can pass this source to (for example) @see Image::newFromSource()
Parameters
- $filename : string
Tags
Return values
selfnewFromMemory()
Make a new source from a memory buffer. For example:
public
static newFromMemory(string $data) : self
$source = Source::newFromMemory(file_get_contents("myfile.jpg"));
You can pass this source to (for example) @see Image::newFromSource()
Parameters
- $data : string
Tags
Return values
selfnick()
Make a human-readable name for a connection suitable for error messages.
public
nick() : string|null
Return values
string|nullonRead()
Attach a read handler.
public
onRead(callable $callback) : void
The interface is similar to fread. The handler is given a number of bytes to fetch, and should return a bytes-like object containing up to that number of bytes. If there is no more data available, it should return null.
Parameters
- $callback : callable
onSeek()
Attach a seek handler.
public
onSeek(callable $callback) : void
The interface is the same as fseek, so the handler is passed parameters for $offset and $whence with the same meanings. However, the handler MUST return the new seek position. A simple way to do this is to call ftell() and return that result. Seek handlers are optional. If you do not set one, your source will be treated as unseekable and libvips will do extra caching.
$whence in particular:
- 0 => start
- 1 => current position
- 2 => end
Parameters
- $callback : callable
printAll()
public
static printAll() : void
ref()
public
ref() : void
set()
public
set(string $name, mixed $value) : void
Parameters
- $name : string
- $value : mixed
Tags
setString()
public
setString(string $string_options) : bool
Parameters
- $string_options : string
Return values
boolsignalConnect()
Connect to a signal on this object.
public
signalConnect(string $name, callable $callback) : void
The callback will be triggered every time this signal is issued on this instance.
Parameters
- $name : string
- $callback : callable
Tags
unref()
public
unref() : void
unrefOutputs()
public
unrefOutputs() : void
getMarshaler()
private
static getMarshaler(string $name, callable $callback) : Closure|null
Parameters
- $name : string
- $callback : callable