apos.images
A subclass of apostrophe-pieces
, apostrophe-images
establishes a library
of uploaded images in formats suitable for use on the web.
Together with apostrophe-images-widgets, this module provides a simple way to add downloadable PDFs and the like to a website, and to manage a library of them for reuse.
Each apostrophe-image
doc has an attachment
schema field, implemented
by the apostrophe-attachments module.
This method is available as a template helper: apos.images.first
Find the first image attachment referenced within an object that may have attachments as properties or sub-properties.
For best performance be reasonably specific; don't pass an entire page or piece object if you can pass page.thumbnail to avoid an exhaustive search, especially if the page has many joins.
For ease of use, a null or undefined within
argument is accepted.
Note that this method doesn't actually care if the attachment is part of
an apostrophe-images
piece or not. It simply checks whether the group
property is set to images
.
Examples:
apos.images.first(page.body)
apos.images.first(page.body, { extension: 'gif' })
(Note Apostrophe always uses .jpg for JPEGs.)
OPTIONS:
You may specify extension
or extensions
(an array of extensions)
to filter the results.
This method is available as a template helper: apos.images.all
Find all image attachments referenced within an object that may have attachments as properties or sub-properties.
For best performance be reasonably specific; don't pass an entire page or piece object if you can pass page.thumbnail to avoid an exhaustive search, especially if the page has many joins.
For ease of use, a null or undefined within
argument is accepted.
Note that this method doesn't actually care if the attachment is part of
an apostrophe-images
piece or not. It simply checks whether the group
property is set to images
.
Examples:
apos.images.all(page.body)
apos.images.all(page.body, { extension: 'gif' })
(Note Apostrophe always uses .jpg for JPEGs.)
OPTIONS:
You may specify extension
or extensions
(an array of extensions)
to filter the results.
Make the minimum size, if any, accessible to the templates
This method is available as a template helper: apos.images.first
Find the first image attachment referenced within an object that may have attachments as properties or sub-properties.
For best performance be reasonably specific; don't pass an entire page or piece object if you can pass page.thumbnail to avoid an exhaustive search, especially if the page has many joins.
For ease of use, a null or undefined within
argument is accepted.
Note that this method doesn't actually care if the attachment is part of
an apostrophe-images
piece or not. It simply checks whether the group
property is set to images
.
Examples:
apos.images.first(page.body)
apos.images.first(page.body, { extension: 'gif' })
(Note Apostrophe always uses .jpg for JPEGs.)
OPTIONS:
You may specify extension
or extensions
(an array of extensions)
to filter the results.
This method is available as a template helper: apos.images.all
Find all image attachments referenced within an object that may have attachments as properties or sub-properties.
For best performance be reasonably specific; don't pass an entire page or piece object if you can pass page.thumbnail to avoid an exhaustive search, especially if the page has many joins.
For ease of use, a null or undefined within
argument is accepted.
Note that this method doesn't actually care if the attachment is part of
an apostrophe-images
piece or not. It simply checks whether the group
property is set to images
.
Examples:
apos.images.all(page.body)
apos.images.all(page.body, { extension: 'gif' })
(Note Apostrophe always uses .jpg for JPEGs.)
OPTIONS:
You may specify extension
or extensions
(an array of extensions)
to filter the results.