This application is not used any more and exists only for history. Post new tickets on the Github account.
Cette application n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Ticket #591 (confirmed enhancement)

Opened 6 years ago

Last modified 3 years ago

plugin image : si l'image n'existe pas ne pas mettre de balise

Reported by: Lipki Owned by:
Priority: low Milestone:
Component: jelix:plugins:tpl Version: 1.0.4
Severity: minor Keywords:
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:

Description

Si l'image n'existe pas ne pas mettre de balise.

Attachments

image.diff (1.3 KB) - added by Lipki 6 years ago.

Change History

comment:1 Changed 6 years ago by Lipki

Je ne suis pas pour cette modification, la balise image affiche une image, si le fichier est absent l'attribut alt entre en action.

Par contre, on peut créer un plugin "isFile" pour tester dans les templates la présence du fichier.

Cela permettra également de détecter les liens morts.

comment:2 Changed 6 years ago by Lipki

  • review set to review?

comment:3 Changed 6 years ago by bastnic

pourquoi faire ça sous forme de plugin ?

comment:4 Changed 6 years ago by Lipki

Si tu parle du plugin is_file, c'est juste une proposition comme ça, j'ai pas vraiment réfléchit...

Ce que je dit surtout c'est que ce n'est pas au plugin image de vérifier l'existence de l'image.

comment:5 Changed 6 years ago by laurentj

  • review review? deleted

comment:6 Changed 6 years ago by bballizlife

I agree with Lipki too. The plugin image should display an image, nothing else. If the image does not exist, never mind, alt attribute is there, with and height attributes will have the effect of doing as if the image exists by taking the same space on the page. That's the web ;)

Nevertheless, there could be and option to this plugin telling to do the check or not.

Think about something like this :

  • not_exists = false (default value, the plugin does not check)
  • not_exists = true (plugin will do the check and won't display the <img> tag if it does not exist)
  • not_exists = path/to/default/img (a string as path to a default image to display if the image does not exist). Could be usefull in some cases.

What to you think about that ?

comment:7 Changed 6 years ago by Lipki

it's good for me !

Changed 6 years ago by Lipki

comment:8 Changed 6 years ago by Lipki

  • review set to review?
  • Version changed from 1.0.3 to 1.0.4

comment:9 Changed 6 years ago by Lipki

Si le plugin ne trouve pas d'image, il ajoute quand même une balise image vide.

Si vous ne voulais pas que la balise img apparaisse, il suffit de le dire.

{image 'data/fichiers/toupie2.png', array('notexists'=>true)}

Mais si vous avez une image de remplacement prévu pour ce cas, il vous faudra spécifier l'url.

{image 'data/fichiers/toupie2.png',
    array('width'=>100,
          'notexists'=>'data/fichiers/pastoupie.png')}

Une fois que l'image manquante aura pris sa place sur le serveur, elle sera visible directement.

comment:10 Changed 6 years ago by Lipki

  • review changed from review? to review-

comment:11 Changed 6 years ago by laurentj

  • review review- deleted

comment:12 Changed 4 years ago by laurentj

  • Component changed from jelix:plugins to jelix:plugins:tpl

comment:13 Changed 3 years ago by laurentj

  • Status changed from new to confirmed
Note: See TracTickets for help on using tickets.