Elgg  Version 4.3
Functions
filestore.php File Reference

Go to the source code of this file.

Functions

 elgg_save_resized_image ($source, $destination=null, array $params=[])
 Crops and resizes an image. More...
 
 elgg_delete_directory (string $directory, bool $leave_base_directory=false)
 Delete a directory and all its contents. More...
 
 elgg_get_download_url (\ElggFile $file, $use_cookie=true, $expires= '+2 hours')
 Returns file's download URL. More...
 
 elgg_get_inline_url (\ElggFile $file, $use_cookie=false, $expires= '')
 Returns file's URL for inline display Suitable for displaying cacheable resources, such as user avatars. More...
 
 elgg_get_embed_url (\ElggEntity $entity, $size)
 Returns a URL suitable for embedding entity's icon in a text editor. More...
 
 elgg_get_uploaded_files ($input_name)
 Returns an array of uploaded file objects regardless of upload status/errors. More...
 
 elgg_get_uploaded_file ($input_name, $check_for_validity=true)
 Returns a single valid uploaded file object. More...
 
 elgg_get_temp_file ()
 Returns a ElggTempFile which can handle writing/reading of data to a temporary file location. More...
 

Function Documentation

elgg_delete_directory ( string  $directory,
bool  $leave_base_directory = false 
)

Delete a directory and all its contents.

Parameters
string$directoryDirectory to delete
bool$leave_base_directoryLeave the base directory intact (default: false)
Returns
bool
Since
3.1

Definition at line 51 of file filestore.php.

elgg_get_download_url ( \ElggFile  $file,
  $use_cookie = true,
  $expires = '+2 hours' 
)

Returns file's download URL.

Note
This does not work for files with custom filestores.
Parameters
\ElggFile$fileFile object or entity (must have the default filestore)
bool$use_cookieLimit URL validity to current session only
string$expiresURL expiration, as a string suitable for strtotime()
Returns
string

Definition at line 105 of file filestore.php.

elgg_get_embed_url ( \ElggEntity  $entity,
  $size 
)

Returns a URL suitable for embedding entity's icon in a text editor.

We can not use elgg_get_inline_url() for these purposes due to a URL structure bound to user session and file modification time. This function returns a generic (permanent) URL that will then be resolved to an inline URL whenever requested.

Parameters
\ElggEntity$entityEntity
string$sizeSize
Returns
string
Since
2.2

Definition at line 136 of file filestore.php.

elgg_get_inline_url ( \ElggFile  $file,
  $use_cookie = false,
  $expires = '' 
)

Returns file's URL for inline display Suitable for displaying cacheable resources, such as user avatars.

Note
This does not work for files with custom filestores.
Parameters
\ElggFile$fileFile object or entity (must have the default filestore)
bool$use_cookieLimit URL validity to current session only
string$expiresURL expiration, as a string suitable for strtotime()
Returns
string

Definition at line 120 of file filestore.php.

elgg_get_temp_file ( )

Returns a ElggTempFile which can handle writing/reading of data to a temporary file location.

Returns
ElggTempFile
Since
3.0

Definition at line 171 of file filestore.php.

elgg_get_uploaded_file (   $input_name,
  $check_for_validity = true 
)

Returns a single valid uploaded file object.

Parameters
string$input_nameForm input name
bool$check_for_validityIf there is an uploaded file, is it required to be valid
Returns
UploadedFile|false

Definition at line 161 of file filestore.php.

elgg_get_uploaded_files (   $input_name)

Returns an array of uploaded file objects regardless of upload status/errors.

Parameters
string$input_nameForm input name
Returns
UploadedFile[]

Definition at line 149 of file filestore.php.

elgg_save_resized_image (   $source,
  $destination = null,
array  $params = [] 
)

Crops and resizes an image.

The following parameters are supported in params:

  • INT 'w' represents the width of the new image With upscaling disabled, this is the maximum width of the new image (in case the source image is smaller than the expected width)
  • INT 'h' represents the height of the new image With upscaling disabled, this is the maximum height
  • INT 'x1', 'y1', 'x2', 'y2' represent optional cropping coordinates. The source image will first be cropped to these coordinates, and then resized to match width/height parameters
  • BOOL 'square' - square images will fill the bounding box (width x height). In Imagine's terms, this equates to OUTBOUND mode
  • BOOL 'upscale' - if enabled, smaller images will be upscaled to fit the bounding box.
Parameters
string$sourcePath to source image
string$destinationPath to destination If not set, will modify the source image
array$paramsAn array of cropping/resizing parameters
Returns
bool
Since
2.3

Definition at line 37 of file filestore.php.