i want to Flip a bunch of Images vertically. In Typoscript i would do that with filelist and the GIFBUILDER Object.
But my Situation is now, that i use a custom Plugin with Extbase Classes and a Fluid Template.
I'm inserting the Images via ...
Does anybody know a good way to vertically flip these images before showing them?
Any Combination of Typoscript and Fluid maybe?
Thanks for your help!
I solved it like this:
In my Extbase Controller i have instantiated t3lib_stdGraphic an transformed the imageas via Imagick. The i saved this image to a directory -> Because i need it in a persistent memory.
The code maybe helpful because i didn't found any good resource for imagick-using in Extbase.
$this->stdGraphic = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_stdGraphic' );
$this->stdGraphic->absPrefix = PATH_site;
$this->stdGraphic->init();
$data = getimagesize("fileadmin/buegel_anprobe/".$artikel->getKurznr().".png");
$width = $data[0];
$height = $data[1];
$transform = $this->stdGraphic->imageMagickConvert("fileadmin/".$artikelname.".png",'png', $width, $height, ' -flop', '', '', 1);
$filepath = $transform[3]
' -flop' is the important argument to flip the image vertically
Then i passed the path to the fluid template and insert it via image-viewhelper
Good resource was the following reference: http://doc-typo3.ameos.com/4.1.0/classt3lib__stdGraphic.html
You have two options in my eyes:
First to write your typoscript as usual (e.g. lib.marks.YOUR-IMAGES = CONTENT or something) and render it via <f:cObject typoscriptObjectPath="lib.marks.YOUR-IMAGES"/>.
Second is to write your own view helper and extending the image view helper included in fluid. You can put your special config in there and use it instead of the normal one.
Related
I have my package from sitepackagebuilder (v9.5.14). I no good at Typoscript. I am using the optional menu navigation file MainBefore.html (my desired file) from bootstrap_package which I put in my stpkg extension because this file is globally available in the FE alongside main menu. I try to explain my doubt in the two following examples.
First one is clear to me. usually I do things like this, (My only known typoscript way to access and render things).
Example 1:
In typoscript
lib.stdContent = FLUIDTEMPLATE
lib.stdContent {
file = EXT:sitepackagebuilder/Resources/Private/Partials/Page/DropIn/Navigation/Data.html
variables {
mylabel = TEXT
mylabel.value = Label coming from TypoScript!
}
}
In Data.html
<h4>Hello TYPO3</h4>
<h3 hidden>{mylabel}</h3>
MainBefore.html
....
<div class="from-data-file"><f:cObject typoscriptObjectPath="lib.stdContent" /></div>
....
The above example will work.
Example 2:
But this following example is my doubt.
page.10 = FLUIDTEMPLATE
page.10.variables.userInfoForChat = COA_INT
page.10.variables.userInfoForChat {
10 = FLUIDTEMPLATE
10 {
file = EXT:company/Resources/Private/Partials/Page/DropIn/Navigation/Data.html
variables {
mylabel = TEXT
mylabel.value = Label coming from TypoScript!
}
}
}
How can I access variables in Data.html and render content in MainBefore.html like example 1? Correct me If I am wrong
Both files are in same location.
First: you are doing very complicated things. normaly stacking templates inside each other is not necessary. so the main question would be: What do you intend to do?
Then we can find a simple way to do it.
I try to identify your intention:
you have a main template (main = main for this example, otherwise it is just a small part of the general page rendering) where you want to have a variable, which is filled from another template, where some variable is inserted.
Some information is missing as these would not be necessary when all values are static like in your example.
There must be something non static as you use a uncached COA_INT and the name userInfoForChat hints to something user specific, which of course is not cachable.
My question is: why do you put a complete fluid templating in the variable, when it should be enough to have only some uncached values in it and stay with just one set of fluid template. (That set already could consists of template, layout and a lot of partials)
I create some custom content elements with tt_content, typoscript and tsconfig etc. in a config extension. All works nice.
When changing to list view my custom content element gets listed under 'pen', which seems to be derived from either the extensionname or a table.
How can I set this name? See image.
You're right that the shown text depends on the table indirectly.
Here is the essential code shown how the name is determined depending on the table-configuration in TCA:
$temp = explode(':', substr($v['ctrl']['title'], 9 + strlen($_EXTKEY)));
$langFile = $temp[0];
$thisTitle = $lang->sL('LLL:EXT:' . $_EXTKEY . '/' . $langFile . ':extension.title');
This snippet is copied from the file typo3/sysext/backend/Classes/Controller/NewRecordController.php in the method renderNewRecordControls().
So in the end the text is determined in the language file(s) of your extension.
To make things easier, I can define the main url of my page as a constant in a template: tx_dti.settings.url = https:/someserver/
Now I like to use this constant in my text element to link an internal page eg:
Contact Form
Unfortunately my above mentioned approach does not work.
What is the correct syntax to replace the server with a constant?
The goal is that I only want to change the constant when I move from a dev to a productive server.
in general:
You can not use typoscript constants outside typoscript templates (constants and setup). If you want to use the value of a typoscript constant in other context you need to transfer the value.
If you want to use the constant in fluid you need to transfer the value to a fluid variable.
temp.content = FLUIDTEMPLATE
temp.content {
template = ...
variables {
domain = TEXT
domain.value = {$myTSconstant}
:
}
}
or
settings {
domain = TEXT
domain.value = {$myTSconstant}
:
}
If you want to use the constant in a data field of a content element you might use a marker and replace the marker with typoscript as last step of rendering.
"<p>This is my text and here I use a marker: __MYMARKER__</p>"
the corresponding typoscript:
page {
:
stdWrap.replacement {
1.search = __MYMARKER__
1.replace = {$myTSconstant}
}
}
Note:
always use TS constants with a $ before the name inside the curly braces.
Don't confuse it with variable usage in fluid (without $).
regarding your problem:
as Riccardo mentioned: don't use constants for your links, even: don't build your links by hand. If you really need your domain in urls, automate it with a setting of config.absRefPrefix (preferrable to config.baseURL)
I guess that you could use config.absRefPrefix or config.baseURL (see https://docs.typo3.org/typo3cms/TyposcriptReference/Setup/Config/)
you can set in TypoScript constants:
tx_dti.settings.url = http://myserver
then in TypoScript Setup:
config.baseURL = {$tx_dti.settings.url}
or
config.absRefPrefix = {$tx_dti.settings.url}
Is this sufficient or am I misunderstanding your request?
new here, and also new to TYPO3.
I need to put something like [imagebox, title='box1'] into content editor and that will be replaced by a text and image with some javascript effect (text and image are managed in the DB elsewhere, the tag is just for the placement in the page).
I've read that TYPO3 has a mechanism for adding custom tags and I managed to make them accepted in the RTE.
I tried instead of [imagebox..... to use
<imagebox>box1</imagebox>
with something like this (copied from web):
tt_content.text.20.parseFunc.tags {
imagebox < lib.parseFunc.tags.link
imagebox = TEXT
imagebox.value= replaced
# imagebox = PHP_SCRIPT
# imagebox {
# stripNL = 0
# Pass a parameter from Typoscript to a PHP script:
# UID of the page containing the SINGLE view of tt_news
# id_singleView = 18
# Call the PHP script
# file = fileadmin/scripts/imagebox_parser.php
# }
}
lib.parseFunc.tags.imagebox < tt_content.text.20.parseFunc.tags.imagebox
should be able to replace content between tags.
I've commented call to php function just tried to get a text replacement for starters.
I've put that in the main root template Setup, but nothing is replaced.
I've also tried other examples from the web with no success.
Did anyone have situation like this?
Are there better approaches for that in TYPO3? (I'm using v7.6.23)
Any suggestion or hint is appreciated.
EDIT: using FSC on textmedia element
I think your examples are outdated. (the object PHP_SCRIPT is obsolete for a long time)
You might have a look at the documentation for your TYPO3 version:
https://docs.typo3.org/typo3cms/TyposcriptReference/7.6/Functions/Parsefunc/
you also need to enhance the parsefunc where you need it. That can depend on:
CSC or FSC?
which kind of content element (CE) do you use? (be sure to enhance the rendering of that CE)
Is it possible to get f:image or v:media.image or a similar available viewhelper to perform some classic TYPO3 imagemagick stunts, like converting an image to grayscale?
Like
10 = IMAGE
10.file.params = -type Grayscale
Or would I have to extend f:image with an own VH?
And If I'd have to do that: I guess it would be the right approach to just pass on these params to IM/GM, right? Where would I have to look to see how that's correctly done?
See this closed issue https://forge.typo3.org/issues/41347,
this feature has existing patch, but was abandoned (see Christian Kuhn comment why -> https://review.typo3.org/#/c/21162/), so now you need an own VH.
Edit:
If you want to have special effects on images you can use CSS property today, just use simple CSS Filters, with pretty nice browsers support today http://caniuse.com/#feat=css-filters
Examples:
http://www.cssreflex.com/css-generators/filter/
https://css-tricks.com/almanac/properties/f/filter/
I use TypoScript to configure images and call them in fluid:
<f:cObject typoscriptObjectPath="lib.fluidResponsiveImages" data="{image.uid}"></f:cObject>
TypoScript example:
#
# TypoScript Setup: lib.fluidResponsiveImages
# Load after tt_content.t3s
#
lib.fluidResponsiveImages = IMAGE
lib.fluidResponsiveImages {
file {
import.current = 1
treatIdAsReference = 1
width = 932
}
sourceCollection < tt_content.image.20.1.sourceCollection
layoutKey < tt_content.image.20.1.layoutKey
layout < tt_content.image.20.1.layout
params < tt_content.image.20.1.params
}