In some cases it’s necessary to incorporate images and other elements into your text, for instance as a way to illustrate the ideas of the text.
In Smartest, these supporting materials are called Attachments. Much like with e-mail, these files accompany the text they are attached to, wherever it appears in the end.
To add an attachment, you will have to enter the Source Editor, since the Rich Text Editor doesn’t display attachments:
There, you’ll see the bare markup that gives the text its formatting. In most cases, markup consists largely of HTML Tags.
Attachments are added by inserting a tag similar to those used in templates (for which the complete syntax and reference is included at the end of this chapter) between the paragraphs.
Attachment tags look like this:
<?sm:attachment name="[attachmentname]" :?>
[attachmentname] must consist of lowercase letters, numbers and underscores, and be unique for each attachment.
As of Smartest revision 752, there is a button that will add attachments for you automatically:
Use the "Add an attachment" button to insert an attachment tag at the cursor, or you can type it manually. One the attachment has been added, it should look like this:
Putting attachments in the right place
What you’ll need to do next is find the spot where the attachment is going to be inserted. This should always be outside a paragraph tag, i.e. at the top of the text above the paragraphs, or just after the
Attaching files within paragraph tags won’t break the system or cause any serious problems, but the resulting output won’t be valid HTML, and you may have unpredictable results.
Hopefully, you’ll recognize the text that you’ve entered and be able to identify the place where you’d like the attachment to be. Remember that you can move it later without affecting it in any other ways.
If the attachment is floated, the top of it will be aligned with the paragraph that comes after it.
Once you have added the attachment tags to the text and saved the text, you can head to the attachments tab, where the tags you added will be picked up, and listed in order that they appear. Click "Attach file..." to choose the file and determine how it should appear:
The form offers slightly different options depending on whether you are attaching a binary image (JPEG, GIF or PNG file), or another file such as audio, video, or an HTML embed code:
As of revision 756, attached files can either be binary images (JPEGs, PNGs, or GIFs), or can be other multimedia file types: Youtube clips, Vimeo clips, MP3 files, Instagram images, or HTML embed codes, which can cater for Soundcloud players, embedded tweets, and other third-party elements.
To attach an image, click the leftmost circular button, An image picker will appear that will allow you to choose or upload an image. When you have selected the image, a switch will appear to enable resizing of the image. If you are uploading directly from a digital camera (not recommended) then you will need to reduce the size of the image substantially. The resize option will allow you to scale the image from 5%-90%, or if the image is already the right size, you can attach it without resizing it.
To attach any other sort of file, choose the button second from left that displays a 'code' icon. This will reveal a dropdown menu of the available files that can be attached. You will need to have created it in the Media library already. Then choose the embed button, and select the file from the dropdown list. In the case of non-images, it is important to make sure a width (in pixels) has been set in the 'Width' box. This should be an integer, and the recommended value is 200-400. The widths of non-image files cannot reliably be determined from the content of the file alone, unlike with images. If a default width and height have already been provided for the file, then this width will be made available as a 'default' value, and the height will be used to calculate a new height for the attachment, proportional to wthe width you enter when attaching the file.
Captions and Floating
All attachments have the possibility of being accompanied by a caption. They can also be situated differently within the text they illustrate, depending on their purpose. They can either be floated, which will cause the text to surround them, or free-standing.
Any attachments that are centered cannot be simultaneously floated.