<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">

<h2>True type font tests</h2>
<f:be.infobox title="FreeType2 hint" state="-1">
    <p>If the two images below do not look the same, please check your FreeType 2 module.</p>
</f:be.infobox>
<div class="t3js-imageProcessing-twinContainer" data-test="imageProcessingTrueType"></div>

<h2>Convert image formats to jpg</h2>
<p>
    This verifies that your ImageMagick installation is able to read the default
    formats <code>jpg</code>, <code>gif</code>, <code>png</code>, <code>tif</code>, <code>pdf</code> and
    <code>ai</code>.
    The tool <code>identify</code> is used to read the pixeldimensions of non-web formats and 'convert' is used to
    read the image and convert it to <code>jpg</code>.
</p>
<f:be.infobox title="Dark images" state="-1">
    <p>
        In case the images appear remarkably darker than the reference images,
        try to set<br/> <code>$GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_colorspace'] = 'sRGB';</code>.
    </p>
</f:be.infobox>

<h3>Read jpg</h3>
<div class="t3js-imageProcessing-twinContainer" data-test="imageProcessingReadJpg"></div>

<h3>Read gif</h3>
<div class="t3js-imageProcessing-twinContainer" data-test="imageProcessingReadGif"></div>

<h3>Read png</h3>
<div class="t3js-imageProcessing-twinContainer" data-test="imageProcessingReadPng"></div>

<h3>Read tif</h3>
<div class="t3js-imageProcessing-twinContainer" data-test="imageProcessingReadTif"></div>

<h3>Read pdf</h3>
<div class="t3js-imageProcessing-twinContainer" data-test="imageProcessingReadPdf"></div>

<h3>Read ai</h3>
<div class="t3js-imageProcessing-twinContainer" data-test="imageProcessingReadAi"></div>

<h2>Writing gif, png, webp</h2>
<p>
    This verifies that ImageMagick is able to write GIF and PNG and WEBP files.
    The GIF-file is attempted compressed by the
    <code>\TYPO3\CMS\Core\Imaging\GraphicalFunctions::gifCompress()</code> function.
</p>

<h3>Write gif</h3>
<div class="t3js-imageProcessing-twinContainer" data-test="imageProcessingWriteGif"></div>

<h3>Write png</h3>
<div class="t3js-imageProcessing-twinContainer" data-test="imageProcessingWritePng"></div>

<h3>Write webp</h3>
<div class="t3js-imageProcessing-twinContainer" data-test="imageProcessingWriteWebp"></div>

<h2>Scaling images</h2>
<p>
    This shows how ImageMagick reacts when scaling transparent GIF and PNG files.
</p>

<h3>gif to gif</h3>
<div class="t3js-imageProcessing-twinContainer" data-test="imageProcessingGifToGif"></div>

<h3>png to png</h3>
<div class="t3js-imageProcessing-twinContainer" data-test="imageProcessingPngToPng"></div>

<h3>gif to jpg</h3>
<div class="t3js-imageProcessing-twinContainer" data-test="imageProcessingGifToJpg"></div>

<h3>jpg to webp</h3>
<div class="t3js-imageProcessing-twinContainer" data-test="imageProcessingJpgToWebp"></div>

<h2>Combining images</h2>
<p>
    This verifies that the ImageMagick tools, <code>combine</code>, <code>composite</code>, are able to
    combine two images through a grayscale mask.
</p>

<h3>Combine using a GIF mask with only black and white</h3>
<div class="t3js-imageProcessing-twinContainer" data-test="imageProcessingCombineGifMask"></div>

<h3>Combine using a JPG mask with graylevels</h3>
<div class="t3js-imageProcessing-twinContainer" data-test="imageProcessingCombineJpgMask"></div>

<h2>GDlib</h2>
<p>
    This verifies that the GDLib installation works properly.
</p>

<h3>Create simple image</h3>
<div class="t3js-imageProcessing-twinContainer" data-test="imageProcessingGdlibSimple"></div>

<h3>Create image from file</h3>
<div class="t3js-imageProcessing-twinContainer" data-test="imageProcessingGdlibFromFile"></div>

<h3>Render text with TrueType font</h3>
<div class="t3js-imageProcessing-twinContainer" data-test="imageProcessingGdlibRenderText"></div>

<h3>Render text with TrueType font using 'niceText' option</h3>
<f:be.infobox title="Note on 'niceText'" state="-1">
    <p>
        'niceText' is a concept that tries to improve the antialiasing of the rendered type by actually
        rendering the textstring in double size on a black/white mask, downscaling the mask and masking
        the text onto the image through this mask. This involves ImageMagick 'combine'/'composite' and 'convert'.
    </p>
</f:be.infobox>
<div class="t3js-imageProcessing-twinContainer" data-test="imageProcessingGdlibNiceText"></div>

<h3>Render 'niceText' with a shadow under</h3>
<f:be.infobox title="Note on 'shadow'" state="-1">
    <p>
        This test makes sense only if the above test had a correct output. But if so, you may not see
        a soft dropshadow from the third text string as you should. In that case you are most likely using
        ImageMagick 5 and should set the flag <code>$GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_effects']</code>.
    </p>
</f:be.infobox>
<div class="t3js-imageProcessing-twinContainer" data-test="imageProcessingGdlibNiceTextShadow"></div>

<div class="panel-group mb-0" id="accordion" role="tablist" aria-multiselectable="true">
    <div class="panel panel-default">
        <div class="panel-heading" role="tab" id="headingConfiguration">
            <h4 class="panel-title">
                <a role="button" data-bs-toggle="collapse" data-bs-parent="#accordion" href="#collapseConfiguration" aria-expanded="true" aria-controls="collapseFive" class="collapsed">
                    <span class="caret"></span>
                    <strong>Current configuration</strong>
                </a>
            </h3>
        </div>
        <div id="collapseConfiguration" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingConfiguration">
            <div class="table-fit">
                <table class="table table-striped">
                    <tr>
                        <td>{imageProcessingProcessor} enabled:</td>
                        <td>{f:if(condition:imageProcessingEnabled, then:'Yes', else:'No')}</td>
                    </tr>
                    <tr>
                        <td>ImageMagick or GraphicsMagick:</td>
                        <td>{imageProcessingProcessor}</td>
                    </tr>
                    <tr>
                        <td>{imageProcessingProcessor} path:</td>
                        <td>{imageProcessingPath}</td>
                    </tr>
                    <tr>
                        <td>{imageProcessingProcessor} version:</td>
                        <td>{imageProcessingVersion}</td>
                    </tr>
                    <tr>
                        <td>{imageProcessingProcessor} effects enabled:</td>
                        <td>{imageProcessingEffects} <span>(Blurring/Sharpening with {imageProcessingProcessor})</span></td>
                    </tr>
                    <tr>
                        <td>GDLib enabled:</td>
                        <td>{f:if(condition:imageProcessingGdlibEnabled, then:'Yes', else:'No')}</td>
                    </tr>
                    <tr>
                        <td>GDLib using PNG:</td>
                        <td>{f:if(condition:imageProcessingGdlibPng, then:'Yes', else:'No')}</td>
                    </tr>
                    <tr>
                        <td>File Formats:</td>
                        <td>{imageProcessingFileFormats}</td>
                    </tr>
                </table>
            </div>
        </div>
    </div>

    <div class="panel panel-default">
        <div class="panel-heading" role="tab" id="headingVerify">
            <h4 class="panel-title">
                <a role="button" data-bs-toggle="collapse" data-bs-parent="#accordion" href="#collapseVerify" aria-expanded="true" aria-controls="collapseFive" class="collapsed">
                    <span class="caret"></span>
                    <strong>Verify test results</strong>
                </a>
            </h3>
        </div>
        <div id="collapseVerify" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingVerify">
            <div class="panel-body">
                <h3>Verify test results</h3>
                <p>
                    This page performs image processing and displays the result. It's a thorough check
                    that everything you've configured is working correctly.
                </p>
                <p>
                    It's quite simple to verify your installation; Just look down the page, the images
                    in pairs should look like each other. If some images are not alike, something is
                    wrong. You may also notice warnings and errors if this tool found signs of any problems.
                </p>
                <p>
                    The image to the left is the reference image (how it should be) and to the right
                    the image made by your server.
                </p>
            </div>
        </div>
    </div>

    <div class="panel panel-default">
        <div class="panel-heading" role="tab" id="headingAbout">
            <h4 class="panel-title">
                <a role="button" data-bs-toggle="collapse" data-bs-parent="#accordion" href="#collapseAbout" aria-expanded="true" aria-controls="collapseFive" class="collapsed">
                    <span class="caret"></span>
                    <strong>About image handling</strong>
                </a>
            </h3>
        </div>
        <div id="collapseAbout" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingAbout">
            <div class="panel-body">
                <p>
                    TYPO3 is known for its ability to process images on the server.
                </p>
                <p>
                    In the backend interface (TBE) thumbnails are automatically generated
                    as well as icons, menu items and pane tabs (by GDLib).
                    In the frontend all kinds of graphical elements are processed. Typically images are
                    scaled down to fit the pages (by ImageMagick) and menu items, graphical headers and
                    such are generated automatically (by GDLib + ImageMagick). In addition TYPO3 is able
                    to handle many file formats (thanks to ImageMagick), for example TIF, BMP, PCX, TGA,
                    AI and PDF in addition to the standard web formats; JPG, GIF, PNG.
                </p>
                <p>
                    In order to do this, TYPO3 uses two sets of tools:
                </p>
                <strong>
                    ImageMagick / GraphicsMagick:
                </strong>
                <p>
                    For conversion of non-web formats to webformats, combining images with alpha-masks,
                    performing image-effects like blurring and sharpening.
                </p>
                <p>
                    ImageMagick is a collection of external programs on the server called by the exec()
                    function in PHP. TYPO3 uses three of these, namely 'convert' (converting fileformats,
                    scaling, effects), 'combine'/'composite' (combining images with masks) and 'identify'
                    (returns image information). GraphicsMagick is an alternative to ImageMagick and can
                    be enabled by setting [GFX][processor] to 'GraphicsMagick'. This is recommended and enabled
                    by default. Because ImageMagick and Graphicsmagick are external programs, a requirement
                    must be met: The programs must be installed on the server and working. ImageMagick is
                    available for both Windows and Unix. The current version is 6+. ImageMagick homepage is
                    at <a href="http://www.imagemagick.org/">http://www.imagemagick.org/</a>
                </p>
                <strong>GDLib:</strong>
                <p>
                    For drawing boxes and rendering text on images with truetype fonts. Also used for
                    icons, menuitems and generally the TypoScript GIFBUILDER object is based on GDlib,
                    but extensively utilizing ImageMagick to process intermediate results.
                </p>
                <p>
                    GDLib is accessed through internal functions in PHP, you'll need a version of PHP
                    with GDLib compiled in. Also in order to use TrueType fonts with GDLib you'll
                    need FreeType compiled in as well.
                </p>
            </div>
        </div>
    </div>

    <div class="panel panel-default">
        <div class="panel-heading" role="tab" id="headingTestImages">
            <h4 class="panel-title">
                <a role="button" data-bs-toggle="collapse" data-bs-parent="#accordion" href="#collapseTestImages" aria-expanded="true" aria-controls="collapseFive" class="collapsed">
                    <span class="caret"></span>
                    <strong>About test images</strong>
                </a>
            </h3>
        </div>
        <div id="collapseTestImages" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTestImages">
            <div class="panel-body">
                <p>
                    Test-Image by Rotkaeppchen68 (in de.wikipedia) [<a href="http://www.gnu.org/copyleft/fdl.html">GFDL</a> or
                    <a href="http://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA-3.0</a>],
                    <a href="https://commons.wikimedia.org/wiki/File%3AFuBK-Testbild.png">via Wikimedia Commons</a>
                </p>
            </div>
        </div>
    </div>
</div>

<div style="display:none;">
    <div class="t3js-imageProcessing-twinImage-template">
        <div class="t3-install-displaytwinimageimages t3js-imageProcessing-images" style="display:none;">
            <div class="row">
                <div class="col-12 col-md-6">
                    <h3>Reference</h3>
                    <div class="bg-transparent-emulation">
                        <img class="reference"/>
                    </div>
                </div>
                <div class="col-12 col-md-6">
                    <h3>Your system</h3>
                    <div class="bg-transparent-emulation">
                        <img class="result"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="t3-install-displaytwinimagetextarea t3js-imageProcessing-command" style="display:none;">
            <pre class="language-bash"><code class="language-bash t3js-imageProcessing-command-text"></code></pre>
        </div>
    </div>
</div>

</html>
