Skip to content

Commit

Permalink
improvements and bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
svewap committed Oct 6, 2024
1 parent 20aaae3 commit 58e2073
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
9 changes: 6 additions & 3 deletions Classes/Controller/FlipbookController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Domain\Model\Folder;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;

Expand Down Expand Up @@ -99,10 +98,14 @@ public function showAction() : ResponseInterface
$bigImageFolder = $this->settings['folder'];
/** @var ResourceFactory $factory */
$factory = GeneralUtility::makeInstance(ResourceFactory::class);
/** @var Folder $folder */
$folder = $factory->getFolderObjectFromCombinedIdentifier($bigImageFolder);

$this->view->assign('files', $folder->getFiles());
$files = $folder->getFiles();
$imageFiles = array_filter($files, function ($file) {
return in_array($file->getExtension(),['jpg','jpeg','png','gif','webp']);
});

$this->view->assign('files', $imageFiles);

}

Expand Down
16 changes: 6 additions & 10 deletions Classes/ViewHelpers/InlineJsViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@


/**
*
*
* @package products
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
*
*/
class InlineJsViewHelper extends AbstractTagBasedViewHelper
Expand Down Expand Up @@ -86,11 +82,11 @@ public function render()
if (count($files) > 0) {
/** @var File $file */
foreach ($files as $file) {
$content .= '{src:"' . $file->getPublicUrl() . '",';
$content .= '{src:"' . $file->getPublicUrl() . '"';
if ($thumbfolder !== NULL) {
$content .= 'thumb:"' . $thumbfolder->getPublicUrl() . $file->getName() . '",';
$content .= ',thumb:"' . $thumbfolder->getPublicUrl() . $file->getName() . '"';
if ($file->getProperty('title')) {
$content .= 'title: "' . $file->getProperty('title') . '"';
$content .= ',title: "' . $file->getProperty('title') . '"';
}
} else {
$content .= '';
Expand Down Expand Up @@ -144,7 +140,7 @@ public function render()
}

/**
* @param integer|NULL $pageUid target PID
* @param int $pageUid target PID
* @param array $additionalParams query parameters to be attached to the resulting URI
* @param integer $pageType type of the target page. See typolink.parameter
* @param boolean $noCache set this to disable caching for the target page. You should not need this.
Expand All @@ -154,10 +150,10 @@ public function render()
* @param boolean $absolute If set, the URI of the rendered link is absolute
* @param boolean $addQueryString If set, the current query parameters will be kept in the URI
* @param array $argumentsToBeExcludedFromQueryString arguments to be removed from the URI. Only active if $addQueryString = TRUE
* @param string $addQueryStringMethod Set which parameters will be kept. Only active if $addQueryString = TRUE
* @param string|null $addQueryStringMethod Set which parameters will be kept. Only active if $addQueryString = TRUE
* @return string Rendered page URI
*/
public function uriPage(int $pageUid, array $additionalParams = [], $pageType = 0, $noCache = FALSE, $noCacheHash = FALSE, $section = '', $linkAccessRestrictedPages = FALSE, $absolute = FALSE, $addQueryString = FALSE, array $argumentsToBeExcludedFromQueryString = array(), $addQueryStringMethod = NULL)
public function uriPage(int $pageUid, array $additionalParams = [], int $pageType = 0, bool $noCache = false, bool $noCacheHash = false, string $section = '', bool $linkAccessRestrictedPages = false, bool $absolute = false, bool $addQueryString = FALSE, array $argumentsToBeExcludedFromQueryString = [], string $addQueryStringMethod = NULL)
{

/** @var UriBuilder $uriBuilder */
Expand Down
15 changes: 9 additions & 6 deletions Resources/Private/Templates/Flipbook/Show.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ <h2>{settings.header}</h2>
</figure>
</f:then>
<f:else>
<figure>
<f:image image="{files.0}" id="container_{uid}" class="rflip-border img-fluid" maxWidth="{settings.previewMaxWidth}" height="{settings.previewMaxHeight}" alt=""/>
<f:if condition="{files.0.description}">
<figcaption>{files.0.description}</figcaption>
</f:if>
</figure>
<f:alias map="{file: '{files -> f:first()}'}">
<figure>
<f:image image="{file}" id="container_{uid}" class="rflip-border img-fluid" maxWidth="{settings.previewMaxWidth}" height="{settings.previewMaxHeight}" alt="{file.alternative}"/>
<f:if condition="{file.description}">
<figcaption>{file.description}</figcaption>
</f:if>
</figure>
</f:alias>

</f:else>

</f:if>
Expand Down

0 comments on commit 58e2073

Please sign in to comment.