Fallback for language depending pictures with missing content

e-Spirit employee
1 0 350

If you are using language depending pictures, maybe you will have the problem, that an editor missed to put a picture within all the languages of the picture.

In this case you will get an error during generation (target for $CMS_REF()$ not found: media:"<UID>") and a broken picture link.

You can solve this problem by using the following code (this will create a fallback to the picture in the master language and create an appropriate warning)

<img src="

$CMS_IF(ref(pt_picture).target.getPicture(#global.language).getPictureMetaData(#global.project.getResolutionByName("ORIGINAL")).size > 0)$




$CMS_VALUE(#global.logWarning("Picture " + ref(pt_picture).target.uid + " (ID:" + ref(pt_picture).target.id + ") has no content within the language " + #global.language.abbreviation))$



If you want to create a link to another resolution then the original resolution, you still have to check the size of the picture in the ORIGINAL resolution for  the appropriate language!