loadAttachmentContext

Description

This function loads an attachment's contextual data including, most importantly, its size if it is an image.

Syntax

array loadAttachmentContext (int $ID_MSG)



Parameter $ID_MSG

Expected type: Integer
Description: The ID of the post to load attachment data for



Return value

Expected type: Array
Description:

Array Elements
Key Optional Expected type Description
byte_size no Integer The actual size of the file, in bytes
downloads no Integer How many times the attachment has been downloaded
height no Integer The height of the image, in pixels
href no String The URL to download the attachment
image no String If this is an image, the HTML code for displaying said image (<img ... />)
is_image no Boolean Whether or not this is an image (true if we're displaying image attachments and the image is a gif, jpeg, png or bmp; false otherwise)
link no String The actual HTML link for downloading the attachment (<a href="href">name</a>)
name no String The real (non-encrypted) name of the file
size no String The text indicating how big the file is in kilobytes (uses byte_size and $txt['smf211'])
width no Integer The width of the image, in pixels


Notes

  • Several additional items were added to this array in 1.1...
Advertisement: