Function __global->convert_image_plus
Definitions
sources/images2.php
- Resize an image to the specified size, but retain the aspect ratio. Has some advanced thumbnailing options.This function works as a higher-level front-end to _convert_image. It doesn't deal in direct filepaths and error responses, it tries it's best and with additional higher level functionality.See tut_tempcode.txt's explanation of the {$THUMBNAIL,...} symbol for a more detailed explanation.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: string
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $orig_url | URLPATH | No | No | required parameter | N/A | N/A | URL to generate thumbnail from |
| $dimensions | ?string | No | No | Null | N/A | N/A | A dimension string, may be a number, or 2 numbers separated by "x" (null: default thumbnail size) |
| $output_dir | PATH | No | No | uploads/auto_thumbs | N/A | N/A | Output directory |
| $filename | ?string | No | No | Null | N/A | N/A | Core filename to use within the overall output filename (null: auto-generate using $orig_url) |
| $fallback_image | ?URLPATH | No | No | Null | N/A | N/A | Fallback URL if we fail (null: use $orig_url) |
| $algorithm | string | No | No | box | box width height crop pad pad_horiz_crop_horiz pad_vert_crop_vert | N/A | Algorithm to use |
| $where | string | No | No | both | start end both start_if_vertical start_if_horizontal end_if_vertical end_if_horizontal | N/A | Where to cut from or pad |
| $background | ?string | No | No | Null | N/A | N/A | Background colour to use for padding, RGB/RGBA style and the "#" may be omitted -- or 'none' (null: choose the average colour in the image) |
| $only_make_smaller | boolean | No | No | False | N/A | N/A | Only ever make the output smaller than the source image, no blowing small images up. Parameter is ignored for crop and pad. |
Returns
- Generated thumbnail URL
- Type: URLPATH
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Resize an image to the specified size, but retain the aspect ratio. Has some advanced thumbnailing options.This function works as a higher-level front-end to _convert_image. It doesn't deal in direct filepaths and error responses, it tries it's best and with additional higher level functionality.See tut_tempcode.txt's explanation of the {$THUMBNAIL,...} symbol for a more detailed explanation.
*
* @param URLPATH $orig_url URL to generate thumbnail from
* @param ?string $dimensions A dimension string, may be a number, or 2 numbers separated by "x" (null: default thumbnail size)
* @param PATH $output_dir Output directory
* @param ?string $filename Core filename to use within the overall output filename (null: auto-generate using $orig_url)
* @param ?URLPATH $fallback_image Fallback URL if we fail (null: use $orig_url)
* @param string $algorithm Algorithm to use
* @set box width height crop pad pad_horiz_crop_horiz pad_vert_crop_vert
* @param string $where Where to cut from or pad
* @set start end both start_if_vertical start_if_horizontal end_if_vertical end_if_horizontal
* @param ?string $background Background colour to use for padding, RGB/RGBA style and the "#" may be omitted -- or 'none' (null: choose the average colour in the image)
* @param boolean $only_make_smaller Only ever make the output smaller than the source image, no blowing small images up. Parameter is ignored for crop and pad.
* @return URLPATH Generated thumbnail URL
*/
function convert_image_plus(string $orig_url, ?string $dimensions = null, string $output_dir = 'uploads/auto_thumbs', ?string $filename = null, ?string $fallback_image = null, string $algorithm = 'box', string $where = 'both', ?string $background = null, bool $only_make_smaller = false) : string
* Resize an image to the specified size, but retain the aspect ratio. Has some advanced thumbnailing options.This function works as a higher-level front-end to _convert_image. It doesn't deal in direct filepaths and error responses, it tries it's best and with additional higher level functionality.See tut_tempcode.txt's explanation of the {$THUMBNAIL,...} symbol for a more detailed explanation.
*
* @param URLPATH $orig_url URL to generate thumbnail from
* @param ?string $dimensions A dimension string, may be a number, or 2 numbers separated by "x" (null: default thumbnail size)
* @param PATH $output_dir Output directory
* @param ?string $filename Core filename to use within the overall output filename (null: auto-generate using $orig_url)
* @param ?URLPATH $fallback_image Fallback URL if we fail (null: use $orig_url)
* @param string $algorithm Algorithm to use
* @set box width height crop pad pad_horiz_crop_horiz pad_vert_crop_vert
* @param string $where Where to cut from or pad
* @set start end both start_if_vertical start_if_horizontal end_if_vertical end_if_horizontal
* @param ?string $background Background colour to use for padding, RGB/RGBA style and the "#" may be omitted -- or 'none' (null: choose the average colour in the image)
* @param boolean $only_make_smaller Only ever make the output smaller than the source image, no blowing small images up. Parameter is ignored for crop and pad.
* @return URLPATH Generated thumbnail URL
*/
function convert_image_plus(string $orig_url, ?string $dimensions = null, string $output_dir = 'uploads/auto_thumbs', ?string $filename = null, ?string $fallback_image = null, string $algorithm = 'box', string $where = 'both', ?string $background = null, bool $only_make_smaller = false) : string

