core-bundle icon indicating copy to clipboard operation
core-bundle copied to clipboard

Image attributes partial override

Open futura-web opened this issue 7 years ago • 12 comments

Is it possible to override only one of the needed attributes (set in the "Dateiverwaltung", var = default_image_meta) in the image ("Metadaten überschreiben")? I suggest to show default_image_meta every time "Metadaten überschreiben" is needed.

futura-web avatar Mar 01 '18 15:03 futura-web

What exactly do you mean by "default_image_meta"?

leofeyer avatar Mar 15 '18 10:03 leofeyer

when you upload an image, you can set values for alt, caption, title, etc. -> default_image_meta (or default_image_attributes?).

futura-web avatar Mar 15 '18 10:03 futura-web

Would such an option fit your needs? bildschirmfoto am 2018-03-15 um 12 47 53 Also the meta data from tl_files should be shown in an extra DIV.

Aybee avatar Mar 15 '18 11:03 Aybee

"Fallback when empty" would be great! So the default behavior is overwrite all meta data from file system and if checked "Fallback when empty" only filled data will be overwrited.

frontendschlampe avatar Mar 15 '18 12:03 frontendschlampe

perfect!

futura-web avatar Mar 15 '18 12:03 futura-web

We have made huge efforts to decrease the number of input fields when adding images in Contao 4.4 (see https://github.com/contao/core/issues/7774), therefore I'm against adding another checkbox.

leofeyer avatar Mar 19 '18 15:03 leofeyer

Can we just show existing values in the corresponding inputs as value="Default value"?

futura-web avatar Mar 19 '18 16:03 futura-web

@leofeyer So we have to put the logic into our templates or write an extension.

Aybee avatar Mar 19 '18 16:03 Aybee

Maybe the initial idea from #964 is a good compromise? The tickets seem related anyway.

leofeyer avatar Mar 19 '18 16:03 leofeyer

a technique i use in my open graph extension is to use context dependant insert tags. the default values of the fields would change to something like {{image::caption}} for the caption field. This means "use the previously known caption of the current image" (e.g. the value from the filesystem metadata). If you want to overwrite the caption to be empty, you would just delete the prefilled insert tag.

backbone87 avatar Mar 27 '18 08:03 backbone87

This would be perfect for developers (who LOVE insert tags), but I expect another weird look from our customers (who don't).

Anyway, any news here (or related: #964) how we could proceed?

Xendiadyon avatar Apr 29 '19 13:04 Xendiadyon

I still prefer this solution https://github.com/contao/core-bundle/issues/1409#issuecomment-487579931

Fallback when empty. The checkbox Overwrite if empty is not necessary if this is the default behaviour, which I recommend.

Whith this solution you can

  • suppress all fields
  • suppress one or more fields
  • change all fields
  • change one or more fields
  • still take advantag from the files meta data if you want to

Consider those CE fields as alternative meta data belonging to only this CE, not to the file itself. The checkbox then is the instruction how to handle empty fields.

What you can not do in one CE is e.g.

  • change Alternate text
  • suppress Image title
  • take Image caption from meta data

So one change, one suppress and one fallback is not possible at the same time (CE).

Prefilling the fields from meta data is dangerous because once done those values are saved in CE dataset. This will not change if meta data changes.

Aybee avatar Apr 29 '19 15:04 Aybee