Image fallback - is it supported?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Image fallback - is it supported?

aDNers
Hello,


Short version of the question:
Is it possible to use images as fallback if a selected language doesn't have a locale version of the image (uploaded as image, not binary)?


Long version:
I have copied an image folder to the localhost installation of dotcms using webdav (all ended up on /webdav/live/1). 

If I print out $URLMapContent in order to list whats available I am indeed able to see the image identifier. But trying to get the value of it using $URLMapContent.image doesn't give me anything - unless I open up the actual image and save a version to my new language.

When I am looking at the content in the admin gui - the image shows (although the actual file has another another language id).

I would really like to be able to show the same image in all languages or "fallback" to the image from the default language if a local language version of the image is not available. If this isn't possible I need to copy the image folder into all possible languages (which seems a bit unnecessary.)

My current settings for fallbacks are as follows, but images doesn't seem to be recognised as either a "File" or a "contentlet". 


## if this variable is set true and the contentlet you are looking is not in the language you are on,
## this will show the contentlet in the default language (Fallback to the default language). If is set to false
## this aditional search is avoided
DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE=true

## it is similar to DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE but only applies for Widgets
DEFAULT_WIDGET_TO_DEFAULT_LANGUAGE=true

## it is similar to DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE but only applies for Pages
DEFAULT_PAGE_TO_DEFAULT_LANGUAGE=true

## it is similar to DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE but only applies for Files
DEFAULT_FILE_TO_DEFAULT_LANGUAGE = true




Here are code version of what I tried to explain above:
$URLMapContent prints:
com.dotmarketing.viewtools.content.ContentMap@12a265c3[content=com.dotmarketing.portlets.contentlet.model.Contentlet@36ddf26c[map={
image=78c7344f-cbce-4995-b286-53e9b7977d91,
context=org.apache.velocity.tools.view.context.ChainedContext@2865775c] 

$URLMapContent.image prints: 
$URLMapContent.image


If I re-save the image as the new language the last row ($URLMapContent.image) instead returns the expected:

com.dotmarketing.viewtools.content.FileAssetMap@11d2139f[
metaData={"
component1":"Y component: Quantization table 0, Sampling factors 2 horiz/2 vert","imageWidth":"980 pixels","component2":"Cb component: Quantization table 1, 
Sampling factors 1 horiz/1 vert","component3":"Cr component: Quantization table 1, Sampling factors 1 horiz/1 vert","xResolution":"1 dot",
"tiffBitspersample":"8","tiff:ImageLength":"551","dataPrecision":"8 bits","numberOfComponents":"3","compressionType":"Baseline",
"imageHeight":"551 pixels","yResolution":"1 dot","resolutionUnits":"none","fileSize":"58446","width":"980","tiff:ImageWidth":"980",
"contentType":"image/jpeg","height":"551"},path=,fileDimension=java.awt.Dimension[width=0,height=0],
map={owner=dotcms.org.1, identifier=78c7344f-cbce-4995-b286-53e9b7977d91, modDate=2017-12-01 14:41:03.0, 
testimage-980x551px.jpg=testimage-980x551px.jpg, languageId=3, showOnMenu=false, 
inode=403c80eb-7b4b-4cd8-bcc6-1121fa8b86f3, 
fileAsset=C:\development\dotcms422_dec\dotserver\tomcat-8.0.18\webapps\ROOT\assets\4\0\403c80eb-7b4b-4cd8-bcc6-1121fa8b86f3\fileAsset\testimage-980x551px.jpg, 
folder=ea18f448-0948-43de-84fc-b71394aaa1b3, disabledWYSIWYG=[], sortOrder=0, modUser=dotcms.org.1, host=48190c8c-42c4-46af-8d1a-0cd5db894797, 
lastReview=2017-12-01 14:41:03.0, stInode=33888b6f-7a8e-4069-b1b6-5c1aa9d0a48d},lowIndexPriority=false] 



--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/11293a48-7d2f-4974-9894-5ce7724bfb8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Image fallback - is it supported?

Chris Falzone-2
We ran into this as well as we have a lot of contents that exist in multiple languages but the referenced files only exist in the default language most of the time.  
This is actually a bug that was introduced in 4x, and there is a fix in the works:  https://github.com/dotCMS/core/issues/12820
It should be falling back to the Default Language if DEFAULT_FILE_TO_DEFAULT_LANGUAGE is set to true (the default)

We've been running in production on 4.1.1 with this code change hotfixed with no issue.  

Hope it helps.

On Fri, Dec 1, 2017 at 11:41 AM aDNers <[hidden email]> wrote:
Hello,


Short version of the question:
Is it possible to use images as fallback if a selected language doesn't have a locale version of the image (uploaded as image, not binary)?


Long version:
I have copied an image folder to the localhost installation of dotcms using webdav (all ended up on /webdav/live/1). 

If I print out $URLMapContent in order to list whats available I am indeed able to see the image identifier. But trying to get the value of it using $URLMapContent.image doesn't give me anything - unless I open up the actual image and save a version to my new language.

When I am looking at the content in the admin gui - the image shows (although the actual file has another another language id).

I would really like to be able to show the same image in all languages or "fallback" to the image from the default language if a local language version of the image is not available. If this isn't possible I need to copy the image folder into all possible languages (which seems a bit unnecessary.)

My current settings for fallbacks are as follows, but images doesn't seem to be recognised as either a "File" or a "contentlet". 


## if this variable is set true and the contentlet you are looking is not in the language you are on,
## this will show the contentlet in the default language (Fallback to the default language). If is set to false
## this aditional search is avoided
DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE=true

## it is similar to DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE but only applies for Widgets
DEFAULT_WIDGET_TO_DEFAULT_LANGUAGE=true

## it is similar to DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE but only applies for Pages
DEFAULT_PAGE_TO_DEFAULT_LANGUAGE=true

## it is similar to DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE but only applies for Files
DEFAULT_FILE_TO_DEFAULT_LANGUAGE = true




Here are code version of what I tried to explain above:
$URLMapContent prints:
com.dotmarketing.viewtools.content.ContentMap@12a265c3[content=com.dotmarketing.portlets.contentlet.model.Contentlet@36ddf26c[map={
image=78c7344f-cbce-4995-b286-53e9b7977d91,
context=org.apache.velocity.tools.view.context.ChainedContext@2865775c] 

$URLMapContent.image prints: 
$URLMapContent.image


If I re-save the image as the new language the last row ($URLMapContent.image) instead returns the expected:

com.dotmarketing.viewtools.content.FileAssetMap@11d2139f[
metaData={"
component1":"Y component: Quantization table 0, Sampling factors 2 horiz/2 vert","imageWidth":"980 pixels","component2":"Cb component: Quantization table 1, 
Sampling factors 1 horiz/1 vert","component3":"Cr component: Quantization table 1, Sampling factors 1 horiz/1 vert","xResolution":"1 dot",
"tiffBitspersample":"8","tiff:ImageLength":"551","dataPrecision":"8 bits","numberOfComponents":"3","compressionType":"Baseline",
"imageHeight":"551 pixels","yResolution":"1 dot","resolutionUnits":"none","fileSize":"58446","width":"980","tiff:ImageWidth":"980",
"contentType":"image/jpeg","height":"551"},path=,fileDimension=java.awt.Dimension[width=0,height=0],
map={owner=dotcms.org.1, identifier=78c7344f-cbce-4995-b286-53e9b7977d91, modDate=2017-12-01 14:41:03.0, 
testimage-980x551px.jpg=testimage-980x551px.jpg, languageId=3, showOnMenu=false, 
inode=403c80eb-7b4b-4cd8-bcc6-1121fa8b86f3, 
fileAsset=C:\development\dotcms422_dec\dotserver\tomcat-8.0.18\webapps\ROOT\assets\4\0\403c80eb-7b4b-4cd8-bcc6-1121fa8b86f3\fileAsset\testimage-980x551px.jpg, 
folder=ea18f448-0948-43de-84fc-b71394aaa1b3, disabledWYSIWYG=[], sortOrder=0, modUser=dotcms.org.1, host=48190c8c-42c4-46af-8d1a-0cd5db894797, 
lastReview=2017-12-01 14:41:03.0, stInode=33888b6f-7a8e-4069-b1b6-5c1aa9d0a48d},lowIndexPriority=false] 



--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/11293a48-7d2f-4974-9894-5ce7724bfb8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/CAMAbHgXbgYbiKRont3s7iMBAJG64o50qqnhW4LGqJyrJ1JYtvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Image fallback - is it supported?

John Michael Thomas
In reply to this post by aDNers
Note also that the fallback only works if you add the Files/Images as "File" or "Image" type fields in the content type; if you're adding files or images in "Binary" fields there's no way for those to fall back (since they're part of the content).  From what you've said I don't think this is what you're doing, but it's something to be aware of when creating your content types.

On Friday, December 1, 2017 at 8:41:55 AM UTC-8, aDNers wrote:
Hello,


Short version of the question:
Is it possible to use images as fallback if a selected language doesn't have a locale version of the image (uploaded as image, not binary)?


Long version:
I have copied an image folder to the localhost installation of dotcms using webdav (all ended up on /webdav/live/1). 

If I print out $URLMapContent in order to list whats available I am indeed able to see the image identifier. But trying to get the value of it using $URLMapContent.image doesn't give me anything - unless I open up the actual image and save a version to my new language.

When I am looking at the content in the admin gui - the image shows (although the actual file has another another language id).

I would really like to be able to show the same image in all languages or "fallback" to the image from the default language if a local language version of the image is not available. If this isn't possible I need to copy the image folder into all possible languages (which seems a bit unnecessary.)

My current settings for fallbacks are as follows, but images doesn't seem to be recognised as either a "File" or a "contentlet". 


## if this variable is set true and the contentlet you are looking is not in the language you are on,
## this will show the contentlet in the default language (Fallback to the default language). If is set to false
## this aditional search is avoided
DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE=true

## it is similar to DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE but only applies for Widgets
DEFAULT_WIDGET_TO_DEFAULT_LANGUAGE=true

## it is similar to DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE but only applies for Pages
DEFAULT_PAGE_TO_DEFAULT_LANGUAGE=true

## it is similar to DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE but only applies for Files
DEFAULT_FILE_TO_DEFAULT_LANGUAGE = true




Here are code version of what I tried to explain above:
$URLMapContent prints:
com.dotmarketing.viewtools.content.ContentMap@12a265c3[content=com.dotmarketing.portlets.contentlet.model.Contentlet@36ddf26c[map={
image=78c7344f-cbce-4995-b286-53e9b7977d91,
context=org.apache.velocity.tools.view.context.ChainedContext@2865775c] 

$URLMapContent.image prints: 
$URLMapContent.image


If I re-save the image as the new language the last row ($URLMapContent.image) instead returns the expected:

com.dotmarketing.viewtools.content.FileAssetMap@11d2139f[
metaData={"
component1":"Y component: Quantization table 0, Sampling factors 2 horiz/2 vert","imageWidth":"980 pixels","component2":"Cb component: Quantization table 1, 
Sampling factors 1 horiz/1 vert","component3":"Cr component: Quantization table 1, Sampling factors 1 horiz/1 vert","xResolution":"1 dot",
"tiffBitspersample":"8","tiff:ImageLength":"551","dataPrecision":"8 bits","numberOfComponents":"3","compressionType":"Baseline",
"imageHeight":"551 pixels","yResolution":"1 dot","resolutionUnits":"none","fileSize":"58446","width":"980","tiff:ImageWidth":"980",
"contentType":"image/jpeg","height":"551"},path=,fileDimension=java.awt.Dimension[width=0,height=0],
map={owner=dotcms.org.1, identifier=78c7344f-cbce-4995-b286-53e9b7977d91, modDate=2017-12-01 14:41:03.0, 
testimage-980x551px.jpg=testimage-980x551px.jpg, languageId=3, showOnMenu=false, 
inode=403c80eb-7b4b-4cd8-bcc6-1121fa8b86f3, 
fileAsset=C:\development\dotcms422_dec\dotserver\tomcat-8.0.18\webapps\ROOT\assets\4\0\403c80eb-7b4b-4cd8-bcc6-1121fa8b86f3\fileAsset\testimage-980x551px.jpg, 
folder=ea18f448-0948-43de-84fc-b71394aaa1b3, disabledWYSIWYG=[], sortOrder=0, modUser=dotcms.org.1, host=48190c8c-42c4-46af-8d1a-0cd5db894797, 
lastReview=2017-12-01 14:41:03.0, stInode=33888b6f-7a8e-4069-b1b6-5c1aa9d0a48d},lowIndexPriority=false] 



--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/370f85da-6d29-43f5-875c-14900cb73d2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Image fallback - is it supported?

Chris Falzone-2
Correct, I think by design.  Binary Fields are only for the current version of the content, you have have to have a copy of the image or file in language version.  

On Fri, Dec 1, 2017 at 1:04 PM John Michael Thomas <[hidden email]> wrote:
Note also that the fallback only works if you add the Files/Images as "File" or "Image" type fields in the content type; if you're adding files or images in "Binary" fields there's no way for those to fall back (since they're part of the content).  From what you've said I don't think this is what you're doing, but it's something to be aware of when creating your content types.


On Friday, December 1, 2017 at 8:41:55 AM UTC-8, aDNers wrote:
Hello,


Short version of the question:
Is it possible to use images as fallback if a selected language doesn't have a locale version of the image (uploaded as image, not binary)?


Long version:
I have copied an image folder to the localhost installation of dotcms using webdav (all ended up on /webdav/live/1). 

If I print out $URLMapContent in order to list whats available I am indeed able to see the image identifier. But trying to get the value of it using $URLMapContent.image doesn't give me anything - unless I open up the actual image and save a version to my new language.

When I am looking at the content in the admin gui - the image shows (although the actual file has another another language id).

I would really like to be able to show the same image in all languages or "fallback" to the image from the default language if a local language version of the image is not available. If this isn't possible I need to copy the image folder into all possible languages (which seems a bit unnecessary.)

My current settings for fallbacks are as follows, but images doesn't seem to be recognised as either a "File" or a "contentlet". 


## if this variable is set true and the contentlet you are looking is not in the language you are on,
## this will show the contentlet in the default language (Fallback to the default language). If is set to false
## this aditional search is avoided
DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE=true

## it is similar to DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE but only applies for Widgets
DEFAULT_WIDGET_TO_DEFAULT_LANGUAGE=true

## it is similar to DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE but only applies for Pages
DEFAULT_PAGE_TO_DEFAULT_LANGUAGE=true

## it is similar to DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE but only applies for Files
DEFAULT_FILE_TO_DEFAULT_LANGUAGE = true




Here are code version of what I tried to explain above:
$URLMapContent prints:
com.dotmarketing.viewtools.content.ContentMap@12a265c3[content=com.dotmarketing.portlets.contentlet.model.Contentlet@36ddf26c[map={
image=78c7344f-cbce-4995-b286-53e9b7977d91,
context=org.apache.velocity.tools.view.context.ChainedContext@2865775c] 

$URLMapContent.image prints: 
$URLMapContent.image


If I re-save the image as the new language the last row ($URLMapContent.image) instead returns the expected:

com.dotmarketing.viewtools.content.FileAssetMap@11d2139f[
metaData={"
component1":"Y component: Quantization table 0, Sampling factors 2 horiz/2 vert","imageWidth":"980 pixels","component2":"Cb component: Quantization table 1, 
Sampling factors 1 horiz/1 vert","component3":"Cr component: Quantization table 1, Sampling factors 1 horiz/1 vert","xResolution":"1 dot",
"tiffBitspersample":"8","tiff:ImageLength":"551","dataPrecision":"8 bits","numberOfComponents":"3","compressionType":"Baseline",
"imageHeight":"551 pixels","yResolution":"1 dot","resolutionUnits":"none","fileSize":"58446","width":"980","tiff:ImageWidth":"980",
"contentType":"image/jpeg","height":"551"},path=,fileDimension=java.awt.Dimension[width=0,height=0],
map={owner=dotcms.org.1, identifier=78c7344f-cbce-4995-b286-53e9b7977d91, modDate=2017-12-01 14:41:03.0, 
testimage-980x551px.jpg=testimage-980x551px.jpg, languageId=3, showOnMenu=false, 
inode=403c80eb-7b4b-4cd8-bcc6-1121fa8b86f3, 
fileAsset=C:\development\dotcms422_dec\dotserver\tomcat-8.0.18\webapps\ROOT\assets\4\0\403c80eb-7b4b-4cd8-bcc6-1121fa8b86f3\fileAsset\testimage-980x551px.jpg, 
folder=ea18f448-0948-43de-84fc-b71394aaa1b3, disabledWYSIWYG=[], sortOrder=0, modUser=dotcms.org.1, host=48190c8c-42c4-46af-8d1a-0cd5db894797, 
lastReview=2017-12-01 14:41:03.0, stInode=33888b6f-7a8e-4069-b1b6-5c1aa9d0a48d},lowIndexPriority=false] 



--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/370f85da-6d29-43f5-875c-14900cb73d2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/CAMAbHgVOcXeRL_3xfQNoZbfGBe_a6-GddVX3H05EmBd-gDe6vA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Image fallback - is it supported?

aDNers
In reply to this post by John Michael Thomas
Chris, John:
Thanks for the quick response. This forum is amazing ☺️
Will check the fix once back at the office on monday, but its really good news that this was a known (and solved) issue. I think it will solve our problem, and (yes - we are using the image field and not binary upload for the requested field.)

Thanks again!

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/0717096d-e89c-4f23-97d1-34e5fb9438b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Image fallback - is it supported?

aDNers
Hi,
Just to confirm, I tried the latest nightly build (commit 18755298b8) and the issue has indeed been solved, so I will keep on developing on this until a 4.3 is ready for production.
Br
Anders

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/753ed03b-a831-426e-afb2-ccb05af78519%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.