Images with HyperCode
How to decorate your posts with images using HyperCode
HyperCode supports several different types of Tags for inserting images. See what they are, the differences, and how to use them.
A post with images becomes much more attractive. Whether it's a post about news, a product, an opinion article, images add an extra sparkle to your post.
HyperCode supports several different types of Tags for inserting images. See here how to use them, what are the types and differences are, and which type is most suitable for each case.
Before proceeding, it is recommended to read and understand Images in HyperFluxCMS.
The image tags described below are some of the HyperCode Tags that are self-contained, meaning they DO NOT NEED and MUST NOT be used in "open/close" pairs. They should be used simply as a single tag..
The img tag is the standard method for inserting images into a post in HyperCode.
Syntax:
[img src="image-name" caption="caption" width="width" height="height"]
src is the only mandatory property.
src must contain the path to a valid image file. It can be:
If it is an image from the site itself, you can also use the path to an Automatic Thumbnail, such as "photo.jpg:300.200.cover".
The "src" property can be omitted and the link can be provided directly after the tag name;
[img="photo.jpg"]
caption is an optional property. If included, the provided text will appear at the bottom of the image, as a caption.
width and height indicate, respectively, the width and height of the image. They can be specified in pixels, pt, %, or any other valid HTML unit of measurement.
If neither the width nor height properties are provided, the image will be inserted in its original pixel size according to the file's own data.
If both width and height properties are provided, the image will be inserted in the specified size. If the measurements do not follow the proportion of the original image, the image will be displayed distorted, compressed, or stretched vertically or horizontally, to occupy exactly the specified size.
If only one of the width or height properties is provided, the image will be inserted with the specified dimension, with the other calculated automatically so that the image is displayed maintaining the original proportion and without distortion.
Like most HyperCode Tags, img optionally accepts the properties class, style, and id. See Class, Style, id
Example:
[img="thumbnail-sample.jpg" width="400" height="225" caption="sample image"]
The thumb tag is the standard method for inserting image thumbnails into a post in HyperCode.
Syntax:
[thumb src="image-link" options="options" width="width" height="height"]
src is a mandatory property.
src must contain the path to a valid image file. It can be:
options indicates the options for generating the thumbnail. It is a /string composed of 3 fields separated by a dot . with no spaces between them.
Example:
[thumb src="hyperfluxcmslogo.jpg" options="300.200.fit"]
width and height indicate, respectively, the display width and height of the image on the page. They can be specified in pixels, pt, %, or any other valid HTML unit of measurement.
If neither the width nor height properties are provided, the image will be inserted exactly in the size indicated in the options property.
If both width and height properties are provided, the image will be inserted in the specified size.
If the measurements do not follow the proportion indicated in options, the image will be displayed distorted, compressed, or stretched vertically or horizontally, to occupy exactly the specified size.
If only one of the width or height properties is provided, the image will be inserted with the specified dimension, with the other calculated automatically so that the image is displayed maintaining the original proportion and without distortion.
Like most HyperCode Tags, thumb optionally accepts the properties class, style, and id. See Class, Style, id
Example:
[thumb src="thumbnail-sample.jpg" options="320.180.fit"]
The image tag is exactly the same as the img tag, being just an alternative name for the same tag, with the same functions and properties.
Example:
[image="logo.jpg"]
is exactly the same as
[img="logo.jpg"]
The floatimg tag is another way to insert an image into a post.
The floatimg tag is very similar to img. The only difference is that, by default, it belongs to the CSS class floatimg and will be displayed on the site slightly differently from a standard img. Otherwise, it is similar to img in syntax and properties. See img Tag.
Example:
[floatimg="thumbnail-sample.jpg" width="320px"]
Like most HyperCode Tags, floatimg optionally accepts the properties class, style, and id. See Class, Style, id
The modalimg tag is another way to insert an image into a post.
The modalimg tag is a simple and useful way to insert photo galleries into a post.
It shows a thumbnail of the photo in the main post, and when the visitor clicks on it, it is displayed enlarged (or at actual size) prominently, with the rest of the page darkened.
After the user clicks an "X" in the corner of the screen, the image closes and normal site viewing is restored.
Syntax:
[modalimg src="image-name" width="width" height="height" caption="Descriptive text" option="options"]
The properties src, caption, width, height, class, style, and id are identical to those of the img tag.
The options property is identical to that of the thumb tag.
Example:
[modalimg src="thumbnail-sample.jpg" width="320" height="180" caption="Click to enlarge" option="320.180.fit"]
Like most HyperCode Tags, modalimg optionally accepts the properties class, style, and id. See Class, Style, id
The coverimg tag is another way to insert an image into a post and serves almost exclusively to insert a cover image into the post.
The coverimg tag is basically the img tag but where the src property can - and should - be omitted, and will be automatically replaced by the image defined as the "cover image" in the page configuration.
If the post is edited and the cover image is modified, the new image will automatically be displayed the next time the page is accessed.
Except for this, the syntax and properties of coverimg are exactly the same as those of the img tag.