.. include:: /Includes.rst.txt
.. index::
Functions; imageLinkWrap
imageLinkWrap
.. _imagelinkwrap:
=============
imageLinkWrap
=============
.. contents::
:local:
.. index:: imageLinkWrap; Properties
.. _imagelinkwrap-properties:
Properties
==========
.. _imagelinkwrap-enable:
enable
------
.. confval:: imageLinkWrap.enable
:name: imagelinkwrap-enable
:type: :ref:`data-type-boolean` / :ref:`stdwrap`
:Default: 0
Whether or not to link the image. Must be set to True to make
:typoscript:`imageLinkWrap` do anything at all.
.. _imagelinkwrap-file:
file
----
.. confval:: imageLinkWrap.file
:name: imagelinkwrap-file
:type: :ref:`stdwrap`
Apply :ref:`stdwrap` functionality to the file path.
.. _imagelinkwrap-width:
width
-----
.. confval:: imageLinkWrap.width
:name: imagelinkwrap-width
:type: :ref:`data-type-positive-integer` / :ref:`stdwrap`
:Default: 0
Width of the image to be shown in pixels. If you add "m" to
:typoscript:`width` or :typoscript:`height` or both then the width and
height parameters will be interpreted as maximum and proportions of the
image will be preserved.
.. _imagelinkwrap-height:
height
------
.. confval:: imageLinkWrap.height
:name: imagelinkwrap-height
:type: :ref:`data-type-positive-integer` / :ref:`stdwrap`
:Default: 0
Width of the image to be shown in pixels. If you add "m" to
:typoscript:`width` or :typoscript:`height` or both then the width and
height parameters will be interpreted as maximum and proportions of the
image will be preserved.
.. _imagelinkwrap-effects:
effects
-------
.. confval:: imageLinkWrap.effects
:name: imagelinkwrap-effects
:type: like :ref:`gifbuilder-effect` of :ref:`GIFBUILDER`
:Default: 0
Apply image effects to the preview image.
.. _imagelinkwrap-effects-example-effects:
Example for effects
~~~~~~~~~~~~~~~~~~~
.. literalinclude:: _codesnippets/_effects.typoscript
:caption: EXT:site_package/Configuration/Sets/Main/setup.typoscript
.. _imagelinkwrap-sample:
sample
------
.. confval:: imageLinkWrap.sample
:name: imagelinkwrap-sample
:type: :ref:`data-type-positive-integer` / :ref:`stdwrap`
:Default: 0
:typoscript:`sample` is a switch which determines how the image
processor (often GraphicsMagick or ImageMagick) calculates the preview
image. If :typoscript:`sample` is true then `- sample` is used with
GraphicsMagick or ImageMagick instead of `- geometry` to calculate the
preview image. `sample` does not use antialiasing and is therefore
much faster than the `geometry` procedure of
GraphicsMagick or ImageMagick.
.. _imagelinkwrap-title:
title
-----
.. confval:: imageLinkWrap.title
:name: imagelinkwrap-title
:type: :ref:`data-type-string` / :ref:`stdwrap`
Specifies the html-page-title of the preview window.
Needs :typoscript:`JSwindow = 1`.
.. _imagelinkwrap-bodyTag:
bodyTag
-------
.. confval:: imageLinkWrap.bodyTag
:name: imagelinkwrap-bodyTag
:type: string / :ref:`stdwrap`
This is the `
`-tag of the preview window.
Needs :typoscript:`JSwindow = 1`.
.. _imagelinkwrap-body-tag-example-setting-bodytag:
Example setting a bodytag for the preview window
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. literalinclude:: _codesnippets/_bodytag.typoscript
:caption: EXT:site_package/Configuration/Sets/Main/setup.typoscript
.. _imagelinkwrap-wrap:
wrap
----
.. confval:: imageLinkWrap.wrap
:name: imagelinkwrap-wrap
:type: :ref:`data-type-wrap`
This wrap is placed around the `
`-tag in the preview window.
Needs :typoscript:`JSwindow = 1`.
.. _imagelinkwrap-target:
target
------
.. confval:: imageLinkWrap.target
:name: imagelinkwrap-target
:type: string / :ref:`stdwrap`
:Default: :typoscript:`thePicture`
This specifies the `target` attribute of the link. The attribute
will only be created if the current :ref:`Doctype `
allows it. Needs :typoscript:`JSwindow = 1`. Default: 'thePicture'.
.. _imagelinkwrap-target-example-alternative-target:
Example: Use an alternative target for the JavaScript Window
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. literalinclude:: _codesnippets/_target.typoscript
:caption: EXT:site_package/Configuration/Sets/Main/setup.typoscript
.. _imagelinkwrap-JSwindow:
JSwindow
--------
.. confval:: imageLinkWrap.JSwindow
:name: imagelinkwrap-JSwindow
:type: :ref:`data-type-boolean` / :ref:`stdwrap`
:Default: 0
If true (:typoscript:`JSwindow = 1`) Javascript will be used to open
the image in a new window. The window is automatically resized to match
the dimensions of the image.
.. _imagelinkwrap-JSwindow-expand:
JSwindow.expand
---------------
.. confval:: imageLinkWrap.JSwindow.expand
:name: imagelinkwrap-JSwindow-expand
:type: :typoscript:`x`, :typoscript:`y` / :ref:`stdwrap`
:Default: 0
:typoscript:`x` and :typoscript:`x` are of data type
:ref:`data-type-integer`. The values are added to the width and height
of the preview image when calculating the width and height of the
preview window.
.. _imagelinkwrap-JSwindow-newWindow:
JSwindow.newWindow
------------------
.. confval:: JSwindow.newWindow
:name: imagelinkwrap-JSwindow-newWindow
:type: :ref:`data-type-boolean` / :ref:`stdwrap`
:Default: 0
If the :ref:`Doctype ` allows the string
attribute then the image will be opened in a window with the name given
by `target`. If that windows is kept open and the next image with the
same string attribute is to be shown then it will appear
in the same preview window.
If :typoscript:`JSwindow.newWindow` is set to True,
then a unique hash value is used as `target` value for each image.
This guarantees that each image is opened in a new window.
.. _imagelinkwrap-JSwindow-altUrl:
JSwindow.altUrl
---------------
.. confval:: imageLinkWrap.JSwindow.altUrl
:name: imagelinkwrap-JSwindow-altUrl
:type: :ref:`data-type-string` / :ref:`stdwrap`
If this returns anything then it is used as URL of the preview window.
Otherwise the default "showpic" script will be used.
.. _imagelinkwrap-JSwindow-altUrl-noDefaultParams:
JSwindow.altUrl\_noDefaultParams
--------------------------------
.. confval:: imageLinkWrap.JSwindow.altUrl_noDefaultParams
:name: imagelinkwrap-JSwindow-altUrl-noDefaultParams
:type: :ref:`data-type-boolean` / :ref:`stdwrap`
:Default: 0
If true (:typoscript:`JSwindow.altUrl_noDefaultParams = 1`) then the
image parameters are not automatically appended to the
:typoscript:`altUrl`. This is useful if you want to add them yourself
in a special way.
.. _imagelinkwrap-typolink:
typolink
--------
.. confval:: imageLinkWrap.typolink
:name: imagelinkwrap-typolink
:type: :ref:`typolink` / :ref:`stdwrap`
If this returns anything it will be used as link and override
everything else.
.. _imagelinkwrap-directImageLink:
directImageLink
---------------
.. confval:: imageLinkWrap.directImageLink
:name: imagelinkwrap-directImageLink
:type: :ref:`data-type-boolean` / :ref:`stdwrap`
:Default: 0
If true (:typoscript:`directImageLink = 1`) then a link will be
generated that points directly to the image file. This means that no
"showpic" script will be used.
.. _imagelinkwrap-linkParams:
linkParams
----------
.. confval:: imageLinkWrap.linkParams
:name: imagelinkwrap-linkParams
:type: :ref:`typolink` / :ref:`stdwrap`
When the direct link for the preview image is calculated all
attributes of :typoscript:`linkParams` are used as settings for the
:ref:`typolink` function. In other words: Use the same parameters
for :typoscript:`linkParams` that you would use for :ref:`typolink`.
Needs :typoscript:`JSwindow = 0`.
Example: Use alternative parameters for the a-tag
Needs :typoscript:`JSwindow = 0`.
.. _imageLinkWrap-example-topup:
.. _imageLinkWrap-example:
Example: Use alternative parameters for the a-tag
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This way it is possible to use a lightbox and to display
resized images in the frontend. A more complete example is
:ref:`imageLinkWrap-example-fancybox`.
.. literalinclude:: _codesnippets/_imageLinkWrap.typoscript
:caption: EXT:site_package/Configuration/Sets/Main/setup.typoscript
.. _imagelinkwrap-stdWrap:
stdWrap
-------
.. confval:: imageLinkWrap.stdWrap
:name: imagelinkwrap-stdWrap
:type: :ref:`stdwrap`
This adds :ref:`stdwrap` functionality to the almost final
result.
.. _imagelinkwrap-what-it-does:
What it does
============
:typoscript:`imageLinkWrap = 1`
If set to True (:typoscript:`= 1`) then this function attaches a link to an image
that opens a special view of the image. By default the link points to
the a "showpic" script that knows how to deal with several parameters.
The script checks an md5-hash to make sure that the parameters are unchanged.
See :ref:`imageLinkWrap-basic-example-showpic`.
There is an alternative. You may set :typoscript:`directImageLink` to True
(:typoscript:`= 1`). In that case the link will directly point to the image
- no intermediate script is involved. This method can well be used to display
images in a lightbox. See :ref:`imageLinkWrap-basic-example-directImageLink`
and the lightbox examples on this page.
If :typoscript:`JSwindow` is True (:typoscript:`= 1`) more fancy
features are available since the preview now is opened by Javascript.
Then the Javascript window title, size, background-color and more can be set to
special values.
.. _imagelinkwrap-implementation:
Implementation
==============
- `imageLinkWrap `__ in API,
- method `imageLinkWrap` in
- class :php-short:`\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer`
in
- namespace :php:`namespace TYPO3\CMS\Frontend\ContentObject;` in
- file :file:`ContentObjectRenderer.php` in
- folder :file:`typo3/sysext/frontend/Classes/ContentObject`.
.. _imagelinkwrap-examples:
Examples for imageLinkWrap
==========================
.. _imageLinkWrap-basic-example-showpic:
Basic example: Create a link to the showpic script
--------------------------------------------------
.. literalinclude:: _codesnippets/_showpic.typoscript
:caption: EXT:site_package/Configuration/Sets/Main/setup.typoscript
.. _imageLinkWrap-basic-example-directImageLink:
Basic example: Link directly to the original image
--------------------------------------------------
.. literalinclude:: _codesnippets/_directImageLink.typoscript
:caption: EXT:site_package/Configuration/Sets/Main/setup.typoscript
.. _imageLinkWrap-example-popup-window:
Example: Larger display in a popup window
-----------------------------------------
.. literalinclude:: _codesnippets/_window.typoscript
:caption: EXT:site_package/Configuration/Sets/Main/setup.typoscript
.. _imageLinkWrap-example-printlink:
Example: Printlink
------------------
.. literalinclude:: _codesnippets/_printlink.typoscript
:caption: EXT:site_package/Configuration/Sets/Main/setup.typoscript
.. _imageLinkWrap-example-fancybox:
Example: Images in lightbox "fancybox"
--------------------------------------
Let's follow this `lightbox.ts example `__
and use `fancybox `_:
.. literalinclude:: _codesnippets/_fancybox.typoscript
:caption: EXT:site_package/Configuration/Sets/Main/setup.typoscript