loadAttachmentContext
Description
This function loads an attachment's contextual data including, most importantly, its size if it is an image.
Syntax
array loadAttachmentContext ()
Return value
Expected type: Array
Description:
Array Elements | |||
Key | Optional | Expected type | Description |
byte_size | no | Integer | The attachment size in bytes |
downloads | no | Integer | How many times this attachment has been downloaded |
height | no | Integer | If there's a thumbnail, this is height of the thumbnail |
href | no | String | The href for the attachment link |
id | no | Integer | The ID of this attachment |
is_image | no | Boolean | Whether or not the attachment is an image (whether or not the attachmentShowImages setting is set and this is a gif, jpeg, bmp or png image) |
link | no | String | The HTML code for the attachment link |
name | no | String | The real name of this attachment (as opposed to the encrypted name) |
real_height | no | Integer | The full height of the image |
real_width | no | Void | The full width of the image |
size | no | String | The size of this attachment in kilobytes (rounded to two decimal places) |
thumbnail | no | Array | An array containing information about the thumbnail ('id' [integer] - the internal ID of the thumbnail image, 'href' [string] - the href for the thumbnail link, 'has_thumb' [boolean] - whether or not this attachment has a thumbnail) |
width | no | Integer | If there's a thumbnail, this is the width of the thumbnail, otherwise it's the same as real_width |
Notes
- Expects the $attachments array to have been filled with the proper attachment data, as Display() does.
- Requires the view_attachments permission to calculate image size.
- Attempts to keep the 'aspect ratio' of the posted image in line, even if it has to be resized.
- Resizes the image as needed based on the max_image_width and max_image_height settings