TargetResource
extends TargetCustom
in package
This class holds a pointer to a VipsObject (the libvips base class) and manages properties.
Table of Contents
- $resource : resource
- __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
- newToDescriptor() : self
- Make a new target to write to a file descriptor (a small integer).
- newToFile() : self
- Make a new target to write to a file name.
- newToMemory() : self
- Make a new target to write to a memory buffer.
- nick() : string|null
- Make a human-readable name for a connection suitable for error messages.
- onEnd() : void
- Attach an end handler.
- onFinish() : void
- Attach a finish handler.
- onRead() : void
- Attach a read handler.
- onSeek() : void
- Attach a seek handler.
- onWrite() : void
- Attach a write 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
$resource
private
resource
$resource
Methods
__clone()
public
__clone() : mixed
Return values
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
Return values
mixed —__destruct()
public
__destruct() : mixed
Return values
mixed —filename()
Get the filename associated with a connection. Return null if there is no associated file.
public
filename() : string|null
Return values
string|null —get()
public
get(string $name) : mixed
Parameters
- $name : string
Tags
Return values
mixed —getArgumentDescription()
public
getArgumentDescription(string $name) : string
Parameters
- $name : string
Return values
string —getBlurb()
public
getBlurb(string $name) : string
Parameters
- $name : string
Return values
string —getDescription()
public
getDescription() : string
Return values
string —getPspec()
public
getPspec(string $name) : CData|null
Parameters
- $name : string
Return values
CData|null —getType()
public
getType(string $name) : int
Parameters
- $name : string
Return values
int —newToDescriptor()
Make a new target to write to a file descriptor (a small integer).
public
static newToDescriptor(int $descriptor) : self
Make a new target that is attached to the descriptor. For example:: $target = VipsTarget.newToDescriptor(1) Makes a descriptor attached to stdout. You can pass this target to (for example) @see Image::writeToTarget()
Parameters
- $descriptor : int
Tags
Return values
self —newToFile()
Make a new target to write to a file name.
public
static newToFile(string $filename) : self
Make a new target that is attached to the file name. For example:: $target = VipsTarget.newToFile("myfile.jpg") You can pass this target to (for example) @see Image::writeToTarget()
Parameters
- $filename : string
Tags
Return values
self —newToMemory()
Make a new target to write to a memory buffer.
public
static newToMemory() : self
For example:: $target = VipsTarget.newToMemory() You can pass this target to (for example) @see Image::writeToTarget()
Tags
Return values
self —nick()
Make a human-readable name for a connection suitable for error messages.
public
nick() : string|null
Return values
string|null —onEnd()
Attach an end handler.
public
onEnd(callable $callback) : void
This optional handler is called at the end of write. It should do any cleaning up necessary, and return 0 on success and -1 on error. Automatically falls back to onFinish if libvips <8.13
Parameters
- $callback : callable
Tags
Return values
void —onFinish()
Attach a finish handler.
public
onFinish(callable $callback) : void
For libvips 8.13 and later, this method is deprecated in favour of @throws Exception
Parameters
- $callback : callable
Tags
Return values
void —onRead()
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. Read handlers on VipsTarget are optional. If you do not set one, your target will be treated as unreadable and libvips will be unable to write some file types (just TIFF, as of the time of writing).
Parameters
- $callback : callable
Return values
void —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
Return values
void —onWrite()
Attach a write handler.
public
onWrite(callable $callback) : void
The interface is exactly as fwrite. The handler is given a bytes-like object to write, and should return the number of bytes written.
Parameters
- $callback : callable
Tags
Return values
void —printAll()
public
static printAll() : void
Return values
void —ref()
public
ref() : void
Return values
void —set()
public
set(string $name, mixed $value) : void
Parameters
- $name : string
- $value : mixed
Tags
Return values
void —setString()
public
setString(string $string_options) : bool
Parameters
- $string_options : string
Return values
bool —signalConnect()
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
Return values
void —unref()
public
unref() : void
Return values
void —unrefOutputs()
public
unrefOutputs() : void
Return values
void —getMarshaler()
private
static getMarshaler(string $name, callable $callback) : Closure|null
Parameters
- $name : string
- $callback : callable