Typo3 Record localization - image

I am struggling with Typo3 / Typoscript.
I want to localize a website to two languages in total (German as default, and English). Using the following typoscript I could localize my standard text records:
lib.main = CONTENT
lib.main {
table = tt_content
select {
pidInList = this
languageField = sys_language_uid
orderBy = sorting
}
renderObj.stdWrap.dataWrap = <section id="tt_content_{field:uid}"><article>|<hr class="clearer"/></article></section>
}
However, no images / media records and their captions are overwritten/localized. I already have these settings in my Typoscript:
config.sys_language_overlay = 1
config.sys_language_softExclude = tt_content:image
config.sys_language_softMergeIfNotBlank = tt_content:image
config.sys_language_mode = strict
The images (and files) and captions are still default German; no translation / localization. Even if I altered the localized record with different files, only the default was visible. Is there another point where I can force localization? Another snippet using the image is a caption wrap (which another one created):
plugin.tx_presets_pi1 {
rendering {
file.import.data = file:current:uid_local
caption {
wrap = <p class="center image-caption">|</p>
}
}
}
Could someone suggest a solution?
I have the feeling that it is a FAL problem (and a reported bug...?!) Thanks for your generous help :)

Localize file or image references: A simpler example for the above solution:
lib.image < styles.content.get
lib.image {
renderObj = FILES
renderObj {
references {
table = tt_content
uid.data = field:uid
fieldName = image
}
renderObj = IMAGE
renderObj {
file.import.data = file:current:publicUrl
altText.data = file:current:alternative
titleText.data = file:current:title
}
}
}
[globalVar = GP:L > 0]
# Reference to localized image (including localized title and alternative)
lib.image.renderObj.references {
uid.data =
l18n_parent.data = field:uid
}
[global]

I had a similar problem: A (parallax) background image with a textbox inside. The content of the textbox is rendered from the images title, description, alternative text and link.
The trick is:
Use l18n_parent instead of uid for relating to the image reference relation if language is > 0 [globalVar = GP:L > 0]. So you get the localization of the images.
This can easily be adapted for sliders as well.
# Image with title, alternative text, description and link, replace 101 with your colPos
lib.bgImageWithTextbox < styles.content.get
lib.bgImageWithTextbox {
select.where = colPos = 101
stdWrap.required = 1
renderObj = FILES
renderObj {
references {
table = tt_content
uid.data = field:uid
fieldName = image
}
renderObj = COA
renderObj {
# Render container with image as background
10 = IMG_RESOURCE
10 {
file.import.data = file:current:publicUrl
file.treatIdAsReference = 1
stdWrap.wrap >
stdWrap.dataWrap (
<div class="g-section-padding-medium js-parallax" data-image-src="/|" data-speed="0.75">
<div class="c-box-background-image">
<h3>{file:current:title}</h3>
<p>{file:current:description}</p>
)
}
# Render textbox with typolink (internal, external, target = _blank etc.)
20 = TEXT
20 {
data = file:current:alternative
typolink.parameter.data = file:current:link
typolink.wrap = |
}
# Close image container
30 = TEXT
30.value (
</div>
</div>
)
}
}
}
[globalVar = GP:L > 0]
# Translation of image texts
lib.bgImageWithTextbox.renderObj.references {
uid.data =
l18n_parent.data = field:uid
}
[global]

Related

Wear OS Button Background

Button(
onClick = {
raceOn = !raceOn
if (raceOn) {
text.value = "Stop!"
color.value = Color.Red
} else {
text.value = "Go!"
color.value = Color.Green
}
},
modifier = Modifier.background(color = color.value),
content = {
Text(
text = "${text.value}",
)
}
)
Using the code above, I got the attached image. What I want is the inside of the button to be green and not the background behind it. I couldn't the right property to modify.
Has anyone here tried to modify the Button background? Or perhaps suggest another solution. I tried the OutlinedButton and wasn't successful.
Thanks!
Use the MaterialTheme ButtonColors.
val colors: ButtonColors = ButtonDefaults.primaryButtonColors(backgroundColor = Color.Red)
Button(onClick = { /*TODO*/ }, colors = ButtonDefaults.primaryButtonColors()) {
// TODO
}
You can also update via setting the MaterialTheme defaults.
val wearColorPalette: Colors = Colors(
primary = Purple200,
primaryVariant = Purple700,
secondary = Teal200,
secondaryVariant = Teal200,
error = Red400,
onPrimary = Color.Black,
onSecondary = Color.Black,
onError = Color.Black
)
...
MaterialTheme(
colors = wearColorPalette,
typography = Typography,
// For shapes, we generally recommend using the default Material Wear shapes which are
// optimized for round and non-round devices.
content = content
)

Fallback for TYPO3 FAL references fieldname

This should be a simple TypoScript question:
I d like to define a fallback field for a FAL image. The default image should be received from a custom field added to the pages table called ogimage. If there`s no image in this field, the image should be received from the media field instead. This is how I tried to make it work - I commented out the different non-working approaches:
page.meta.og:image {
cObject = FILES
cObject {
references {
table = pages
uid.field = uid
fieldName = media
#fieldName.field = ogimage // media
#fieldName.override = ogimage
#fieldname.override.required = 1
#fieldName.override.if.isTrue.field = ogimage
#fieldName.override.if.isTrue.data = page:ogimage
}
renderObj = IMG_RESOURCE
renderObj {
stdWrap.prepend = TEXT
stdWrap.prepend {
data = getIndpEnv: TYPO3_REQUEST_HOST
wrap = |/
}
file.import.data = file:current:publicUrl
file.maxW = 1500
}
}
}
Any ideas how to solve this?
Yesterday, we had the same problem and your question inspired me. You've been quite close to the solution. This should work:
page.meta.og:image {
cObject = FILES
cObject {
references {
table = pages
uid.field = uid
fieldName = ogimage
fieldName.override = media
fieldName.override.if.isFalse.field = ogimage
}
...
}
}
Since fieldName only contains the field's name there is no image reference or something like that. It is just a string but - as you have tried - the property is stdWrap-able. So the override provides an alternative field name. This is only applied your custom field is empty ("0" which means it has no reference to sys_file_references).

Multiple Images in TemplaVoila Template, TYPO3 6+

You can find many snippets online for the DataStructure of a TemplaVoila FCE, to let it render multiple images in one field. This doesn't work on TYPO3 6+. The whole object just doesn't pop up, but TemplaVoila is also not throwing an error.
The Typoscript of the DS looks like this:
10 = COA
10 {
10 = HTML
10 {
value.field = field_carousel
value.split {
token = ,
cObjNum = 1
1 {
10 = IMAGE
10 {
file {
import.current = 1
import = uploads/tx_templavoila/
maxW = 1920
}
}
}
}
}
}
The field-name is correct. As you can see here: https://snipt.net/mawe/f/ it works actually on TYPO3 4.7.x. Though, on 6+ it seems to break something. The output remains blank.
The field-type is image (I tried it with fixed width/height and without). If I keep the original TypoScript, it just shows the first image in my list, which is the correct behaviour:
10 = IMAGE
10 {
file {
import = uploads/tx_templavoila/
import.current = 1
import.listNum = 1
maxW = 1920
}
}
Anyone knows, how to solve this problem? The final result has to be something like this (I need to wrap it into those div containers as well):
<div class="item">
<img src"..." alt="" title="" />
</div>
<div class="item">
<img src"..." alt="" title="" />
</div>
...
cObj HTML is deprecated: TYPO3 lib HTML and TEXT code
So simply change your code to:
10 = COA
10 {
10 = TEXT
10 {
value.field = field_carousel
value.split {
token = ,
cObjNum = 1
1 {
10 = IMAGE
10 {
file {
import.current = 1
import = uploads/tx_templavoila/
maxW = 1920
}
}
}
}
}
}

size of picture windows phone

in my app i have a list of picture. I would like to determine the size of the single images but not have property.
using (MediaLibrary library = new MediaLibrary())
{
CameraRollAlbum = library.RootPictureAlbum.Albums.First((album) => album.Name == "Camera Roll");
List<Picture> pictures = CameraRollAlbum.Pictures.Tolist();
foreach (Picture pic in pictures)
{
pic.size?? pic.length??
}
}
Get the Image Stream eval the size:
foreach (Picture pic in pictures)
{
var sizeInKb = pic.GetImage().Length / 1024;
}
http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.media.picture_members.aspx

white space get trimmed after adding custom tags in CKEditor

function sidebar(editor)
{
var selection = editor.getSelection();
if(selection.getSelectedText()!="")
{
var range = selection.getRanges();
var customNode = editor.document.createElement( 'cdl:sidebar' );
var extractedContent = range[0].extractContents();
customNode.append(extractedContent);
var sidebarHolder = editor.document.createElement("sidebarHolder");
sidebarHolder.append(customNode);
var nodeHtml = sidebarHolder.getHtml();
editor.insertHtml(nodeHtml+" ");
}
else {
showErrorMessage("Selection is not proper");
}
}
This is my code.Whenever i select a single word like "Please" in "Please post comments or corrections" statement ,after adding tags Please.The space between "Please Post" get's trimmed.But when i select "Please "(word with space),the code works correctly.And , i want that tag should not visible in editor , it should be visible in source panel.
Try appending html to ckeditor instance rather adding text.

Resources