terminal42 / contao-pageimage Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Hi,
kann man es irgendwie möglich machen auch SVGs als pageimage auszuwählen? Mit einer einfachen Anpassung per dcaconfig á la:
$GLOBALS['TL_DCA']['tl_page']['fields']['pageImage'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_page']['pageImage'],
'inputType' => 'fileTree',
'exclude' => true,
'eval' => array('fieldType'=>'checkbox', 'orderField'=>'pageImageOrder', 'multiple'=>true, 'files'=>true, 'filesOnly'=>true, 'extensions'=>'jpg,jpeg,gif,png,svg', 'isGallery'=>true),
'sql' => "blob NULL",
);
kann ich zwar eine svg auswählen, sie kommt aber nicht im FE an.
[2021-02-23T12:51:49.316887+01:00] request.INFO: Matched route "tl_page.2.root". {"route":"tl_page.2.root","route_parameters":{"_token_check":true,"_controller":"Contao\\FrontendIndex::renderPage","_scope":"frontend","_locale":"de","_format":"html","parameters":"","pageModel":{"Contao\\PageModel":[]},"_route":"tl_page.2.root","_route_object":{"Symfony\\Component\\Routing\\Route":[]}},"request_uri":"http://mywebsite.com/","method":"GET"} [] [2021-02-23T12:51:49.344184+01:00] security.INFO: Populated the TokenStorage with an anonymous Token. [] [] [2021-02-23T12:51:49.409114+01:00] request.CRITICAL: Uncaught PHP Exception LogicException: ""contao.fragment._contao.frontend_module.pageimage" has no container set, did you forget to define it as a service subscriber?" at /www/htdocs/mywebsitepath/vendor/symfony/framework-bundle/Controller/ControllerResolver.php line 39 {"exception":"[object] (LogicException(code: 0): \"contao.fragment._contao.frontend_module.pageimage\" has no container set, did you forget to define it as a service subscriber? at /www/htdocs/mywebsitepath/vendor/symfony/framework-bundle/Controller/ControllerResolver.php:39)"} []
bei Verwendung des mod_pageimage_background.html5 wird der Wert "-webkit-min-device-pixel-ratio" mit ausgegeben ("../contao-pageimage/src/Controller/PageimageController.php" zeile 132).
Auch wenn ich bei den Bildgrößen (Themes > Bildgrößen) bei den Media-Querys keine Pixeldichte angebe, wird "-webkit-min-device-pixel-ratio" IMMER ausgegeben ...(?) ähnlich wie hier:
@media screen and (max-width: 2600px) and (-webkit-min-device-pixel-ratio: 2560w), screen and (max-width: 2600px) and (min-resolution: 2560wdppx) { html { background-image: url("assets/images/../****.jpg"); } }
Diese Angabe macht in meinem Szenario die kompletten @media Anweisung unbrauchbar und haben somit keine Auswirkungen mehr. Auch wird diese explizit als non-standard bei https://developer.mozilla.org/en-US/docs/Web/CSS/@media/-webkit-device-pixel-ratio deklariert
Wieso ist diese zusätzliche Angabe enthalten?
Ich habe die Ausgabe über eine eigene Schleife gelöst (ähnlich @DanEi75) wo die "-webkit-min-device-pixel-ratio" nicht mit ausgegeben wird und es funktioniert einwandfrei.
Originally posted by @albirs in #40 (comment)
Hallo,
habt ihr vor die Erweiterung so zu aktualisieren, dass diese für die Responsive Image Funtkion von Contao 3.4 lauffähig ist?
Das wäre großartig.
Ich versuche gerade selbiges mit einer Template Anpassung zu erzielen, aber wenn die gesamte Erweiterung das automatisch unterstützen würde, wäre es sicher performanter.
It would be nice, to have an Field for external URL's. With this it would be possible to link to a News ore something else. At the Moment there is only an internal Page possible.
regards
The file picker in the backend supports multiple files (#25). I'm wondering how to access all images in a loop, to create a custom slider. Inside the templates/
directory are to example files, I think it would be great to have a third with an loop over all selected images as reference for custom implementations.
I'm using Contao 4.5.4 with PageImage 3.3.1.
In page structure you can enter an alt-text for the page image. We maintain the alt-text in the file system, but the extension don't fall back to the information in file system. When I don't enter an alt-text in page structure, no alt-text will be served.
Could you make a fallback using the alt-text from file system if the field for alt-text in page structure is empty?
Der Bildttitel aus der Dateiverwaltung fehlt im Template. Hier scheint es nur linkTitle zu geben. Wie bekomme ich den title in:
<?php $this->insert('picture_default', $image['picture']); ?>
ausgegeben?
Es wäre überaus praktisch wenn die Vererbung pro Unterseite deaktiviert werden könnte.
Customer crashed his installation with that update, I guess this is a mistake?
Wäre es nicht schön, wenn Pageimage die neue picture-Funktionalität unterstützen würde..?
Fehler : Undefined array key "hasLink"
im Debug-Modus
PHP 8.1.2
Contao: 4.12.7
contao-pageimage: 4.1.3
Hier der Stacktrace
ErrorException:
Warning: Undefined array key "hasLink"
at vendor/terminal42/contao-pageimage/contao/templates/mod_pageimage.html5:6
at include('/mnt/web023/d3/57/5890957/htdocs/bws-contao4/vendor/terminal42/contao-pageimage/contao/templates/mod_pageimage.html5')
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/TemplateInheritance.php:111)
at Contao\Template->inherit()
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/Template.php:300)
at Contao\Template->parse()
(vendor/contao/core-bundle/src/Resources/contao/classes/FrontendTemplate.php:45)
at Contao\FrontendTemplate->parse()
(vendor/contao/core-bundle/src/Resources/contao/classes/FragmentTemplate.php:36)
at Contao\FragmentTemplate->compile()
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/Template.php:327)
at Contao\Template->getResponse()
(vendor/contao/core-bundle/src/Resources/contao/classes/FrontendTemplate.php:87)
at Contao\FrontendTemplate->getResponse()
(vendor/contao/core-bundle/src/Resources/contao/classes/FragmentTemplate.php:25)
at Contao\FragmentTemplate->getResponse()
(vendor/terminal42/contao-pageimage/src/Controller/PageimageController.php:59)
at Terminal42\PageimageBundle\Controller\PageimageController->getResponse()
(vendor/contao/core-bundle/src/Controller/FrontendModule/AbstractFrontendModuleController.php:40)
at Contao\CoreBundle\Controller\FrontendModule\AbstractFrontendModuleController->__invoke()
(vendor/symfony/http-kernel/HttpKernel.php:152)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
(vendor/symfony/http-kernel/HttpKernel.php:74)
at Symfony\Component\HttpKernel\HttpKernel->handle()
(vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php:86)
at Symfony\Component\HttpKernel\HttpCache\SubRequestHandler::handle()
(vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php:80)
at Symfony\Component\HttpKernel\Fragment\InlineFragmentRenderer->render()
(vendor/symfony/http-kernel/Fragment/FragmentHandler.php:85)
at Symfony\Component\HttpKernel\Fragment\FragmentHandler->render()
(vendor/contao/core-bundle/src/Fragment/FragmentHandler.php:84)
at Contao\CoreBundle\Fragment\FragmentHandler->render()
(vendor/contao/core-bundle/src/Resources/contao/modules/ModuleProxy.php:61)
at Contao\ModuleProxy->generate()
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php:421)
at Contao\Controller::getFrontendModule()
(vendor/contao/core-bundle/src/Resources/contao/pages/PageRegular.php:200)
at Contao\PageRegular->prepare()
(vendor/contao/core-bundle/src/Resources/contao/pages/PageRegular.php:65)
at Contao\PageRegular->getResponse()
(vendor/contao/core-bundle/src/Resources/contao/controllers/FrontendIndex.php:339)
at Contao\FrontendIndex->renderPage()
(vendor/symfony/http-kernel/HttpKernel.php:152)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
(vendor/symfony/http-kernel/HttpKernel.php:74)
at Symfony\Component\HttpKernel\HttpKernel->handle()
(vendor/symfony/http-kernel/Kernel.php:202)
at Symfony\Component\HttpKernel\Kernel->handle()
(web/preview.php:33)
Hi, I tried to put in background images as a module to my page layout. Unfortunately it didn't work. Normal page images are displayed correctly. Could it be a problem with Contao 4.4.14 or a general bug?
Please add it to the 3.0.0 release branch.
useCss seems to be a flag in the template mod_background_image.html5.
If true, a simple CSS-style is used, otherwise a javascript-solution for positioning and sizing the image.
How is this flag set? I cannot find it in the module configuration.
Es wäre gut, wenn die Erweiterung mehrere Bilder unterstützen würde. Dadurch könnte bei Bedarf z.B. eine Slideshow einfach realisiert werden.
In der 3.x Version scheinen ja schon Vorkehrungen dafür gemacht worden zu sein:
public static function getMultiple(...
Ist hier vielleicht schon zeitnah mit einer Umsetzung zu rechnen?
To me it seems as though pageimage 3 in Contao 3.2 does not inherit the page image from any parent page except the root page if no image is set on a page. The page "Contact" in this example has the red image, although it should be the green one:
Nach dem Update von 2.11.x auf 3.2 habe ich alle Bilder neu zugeordnet/aktiviert - leider funktioniert die Vererbung an die Kinderseiten nicht (mehr).
Change
document.body.grab(...)
to
document.id(document.body).grab(...)
Hallo Andreas, im Template mod_background_image https://github.com/terminal42/contao-pageimage/blob/master/templates/mod_background_image.html5#L3-L9 hast du dieses CSS.
html {
background: url("<?php echo specialchars($this->src); ?>") no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
Damit kann man aber kein background-color
und andere background-Eigenschaften für HTML mehr aufsetzen. Könntest du dies wie folgt abändern? Die Präfixe sind IMHO mittlerweile auch überflüssig.
html {
background-image: url("<?= specialchars($this->src) ?>");
background-repeat: no-repeat;
background-position: center;
background-attachment: fixed;
background-size: cover;
}
Danke.
Hallo
So wie es scheint, werden definitierte Bildgrössen nicht berücksichtigt, wenn die Darstellung als Background-Image gewählt wird. Bei der Einbindung als normales Bild hingegen schon. Ist das nicht möglich oder hat man es vergessen (kein Vorwurf :-)), dies dort auch zu berücksichtigen?
Thx
In the PageImage.php at line 42 (https://github.com/terminal42/contao-pageimage/blob/develop/PageImage.php#L42) there is a static call to the method "findOne". However, the Class PageImage does not have a function called "findOne", it does have a function called "getOne" though.
I am guessing this is a small error? It seems to break the insert tags: https://community.contao.org/de/showthread.php?53896-pageimage-Bild-im-Meta-Tag&p=347639&viewfull=1#post347639 (haven't tested myself).
I just noticed that this extension is not available on Packagist and thus not installable via Contao's Composer client.
I installed this extension in a fresh installation. When I select a page image, it is not taken over. If I go there again, no selection is made.
In Contao 3.2 funktioniert pageimage nicht mehr. Liegt offensichtlich am Datenbank-Feld. Ändere ich den Typ in binary, geht's.
CREATE TABLE `tl_page` (
`pageImage` binary(16) NULL,
`pageImageJumpTo` varchar(255) NOT NULL default '',
`pageImageAlt` varchar(255) NOT NULL default '',
`pageImageTitle` varchar(255) NOT NULL default '',
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Allerdings funktioniert die Vererbung auch nicht mehr.
Ich hatte aber leider noch keine Zeit zur Recherche.
The insert tag {{pageimage::*}}
is not working. The problem is in these lines of code of PageImage.php:
if (null === $arrImage || !isset($arrImages[$strKey])) {
return '';
}
return $arrImages[$intIndex][$strKey];
$arrImages
is not a valid variable in the function's context. Even if you use static::$arrImages
instead, there is no variable $intIndex
in the function's context. The lines should instead say this:
if (null === $arrImage || !isset($arrImage[$strKey])) {
return '';
}
return $arrImage[$strKey];
However, then there is another problem. $strKey
will default to 'src'
when using the insert tag {{pageimage::*}}
. But there is no array key named 'src'
in $arrImage
. The contents in $arrImage
come from the \FilesModel
. The path to the image is actually in the array key 'path'
, not 'src'
. So line #34 should probably be changed to
$arrTag[0] = 'pageimage_path';
or later on pageimage_src
should be transformed to pageimage_path
for example.
Es führt bei unerfahrenen Redakteuren schnell zu Fehlern, dass hier mehrere Bilder ausgewählt werden können... Sollte hier nicht besser die Einfach-Auswahl aktiviert werden?
Hallo nochmals Andreas,
wo ich das Modul für einen Kunden gerade noch fertig eingerichtet habe, fällt mir auf, dass es anscheinend ein Problem mit dem Dateiwähler gibt:
Im Dateiwähler kann man ja normalerweise (genauso wie in der Dateiverwaltung) den sichtbaren Ausschnitt ("Filemount") des Ordner-Baumes verändern; indem man auf einen Ordnernamen klickt, bzw. über die "Breadcrumbs" im gelben Feld oben diesen dann auch wieder zurück-erweitert...
Dabei fiel mir jetzt folgendes Phänomen/Problem auf:
Zunächst hatte ich (egal ob als Admin oder "Redakteur") keine Möglichkeit den (zu diesem Zeitpunkt) eingeloggten Ausschnitt im Pageimage-Dateiwähler wieder auf die Mutterknoten zu erweiteren. Im Dateiwähler eines Content-Elements aus einem Artikel sah ich, dass dort der selbe Ausschnitt aktiviert war. Dort konnte ich allerdings die Übersicht wieder komplett (bis in den Datei-Root) öffnen. Beim Zurückkehren in einen Pageimage-Dateiwähler war die Übersicht dann auch wieder komplett geöffnet. Irgendwie scheinen die beiden Module da also gekoppelt zu sein. Jedoch kann ich im Pageimage-Dateiwähler den sichtbaren Ausschnitt nach wie vor nicht verändern; bei Klick auf einen Ordnernamen passiert also nichts...
Ne Idee was das sein könnte? Kann ich meinem Kunden so natürlich nicht abliefern...
Viele Grüße, Hendriks
Ich erzeuge mit dem folgenden Code das Markup für einen Slider wenn mehrere Bilder pro Seite ausgewählt werden. Wie kann ich das Contao-Picture-Template nutzen, um auch die responsive Größen mit im Markup zu haben? Hier ist es ja nur das einfache img-Tag.
<?php
global $objPage;
$collection = \FilesModel::findMultipleByUuids(deserialize($objPage->pageImageOrder)); // oder ->pageImage ohne Sortierung
?>
<?php if (count($collection) > 1): ?>
<?php foreach($collection as $image)
{
echo '<div><img src="'.\Image::get($image->path, 300, 300, 1).'" alt=""></div>';
}
?>
<?php else: ?>
...
<?php endif; ?>
It seems, that I cannot choose a webp-image in the pageimage-feature. How can I change that? I added webp to allowed file types in Contao settings.
Changing the template names to
mod_backgroundImage.html5
mod_pageImage.html5
and creating a runonce to change existing files
I have Contao 3.2.14 installed.
I needed to rewrite the whole function replaceTags to make insert tags work.
public static function replaceTags($strTag)
{
$arrTag = trimsplit('::', $strTag);
$strKey;
switch($arrTag[0])
{
case 'pageimage':
case 'pageimage_src':
$strKey = 'path';
break;
case 'pageimage_alt':
$strKey = 'name';
break;
case 'pageimage_title':
$strKey = 'name';
break;
case 'pageimage_href':
$strKey = 'path';
break;
default:
return false;
}
global $objPage;
$arrImage = static::getOne($objPage, (int) $arrTag[1]);
if (null === $arrImage || !isset($arrImage[$strKey])) {
return '';
}
return $arrImage[$strKey];
}
Wenn im Modul eine definierte Bildgröße ausgewählt wird, bei der eine CSS-Klassen für den img-Tag angegeben wurde, wird die Klasse nicht mit ausgegeben. Auch in den Template-Variablen ist die Klasse im img Array nicht vorhanden.
It seems that pageimage has a slight problem inheriting parent images in Contao 3.3.4. It does not inherit the page image from any parent page. The page "B" in this example has no image, although it should get the one from "A":
Question: Will there be a fix for Contao 5.1.x for the Contao extension "Pageimage" in the above future? I would be very happy about it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.