mAucun résumé des modifications |
Aucun résumé des modifications |
||
Ligne 11 : | Ligne 11 : | ||
This is why we don't use inexpensive {{ifexist}} instead. |
This is why we don't use inexpensive {{ifexist}} instead. |
||
− | -->{{# |
+ | -->{{#dplvar:set<!-- |
− | -->{{ |
+ | -->|_image_name|{{{1|}}}<!-- |
− | + | -->|_image_exist|<!-- |
|
− | + | -->|_image_width|0<!-- |
|
− | + | -->|_image_height|0<!-- |
|
− | + | -->|_image_cached|{{#time:U}}<!-- |
|
− | + | -->}}<!-- |
|
+ | |||
⚫ | |||
+ | // if file is not exist {{#imgw:}} will get 0, if expensive call limit is exceeded it will get "Error returning width" |
||
− | -->{{#ifexpr:{{#dplvar:_image_width}}|{{#ifexpr:{{#dplvar:_image_height}}|<!-- width !=0 and height != 0 |
||
+ | -->{{#ifeq: {{#expr: {{#vardefineecho:_imgw|{{#imgw:{{{1|}}}}}}} = 0 }} | 0 |<!-- false if 0 or error, otherwise true. |
||
+ | /* NOTE: {{#imgw:}} and {{#imgh:}} both are expensive call, therefore, there is such an edge case: |
||
+ | * the {{#imgw:}} above is the last allowed expensive call, and the {{#imgh:}} call below will fail because it reaches the limit. |
||
+ | * We only store info when BOTH calls are successful. |
||
+ | */ |
||
+ | -->{{#ifeq: {{#expr: {{#vardefineecho:_imgh|{{#imgh:{{{1|}}}}}}} = 0 }} | 0 |<!-- |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
-->{{#cargo_store:_table = Imageinfo<!-- |
-->{{#cargo_store:_table = Imageinfo<!-- |
||
-->|image={{#dplvar:_image_name}}<!-- |
-->|image={{#dplvar:_image_name}}<!-- |
||
Ligne 26 : | Ligne 37 : | ||
-->|cached={{#dplvar:_image_cached}}<!-- |
-->|cached={{#dplvar:_image_cached}}<!-- |
||
-->}}<!-- |
-->}}<!-- |
||
− | -->}}}}<!-- |
||
− | -->|<!-- not exist or over limit |
||
⚫ | |||
− | -->|_image_name|{{{1|}}}<!-- |
||
⚫ | |||
⚫ | |||
⚫ | |||
− | -->|_image_cached|{{#time:U}}<!-- |
||
-->}}<!-- |
-->}}<!-- |
||
-->}}<!-- |
-->}}<!-- |
||
+ | |||
--></includeonly><!-- |
--></includeonly><!-- |
||
Ligne 41 : | Ligne 45 : | ||
Internal sub-template. See {{tl|image}} for documentation. |
Internal sub-template. See {{tl|image}} for documentation. |
||
− | + | {{Category|Templates}} |
|
[[de:Vorlage:Image/storeinfo]] |
[[de:Vorlage:Image/storeinfo]] |
||
[[en:Template:Image/storeinfo]] |
[[en:Template:Image/storeinfo]] |
Version du 4 mars 2021 à 04:38
Internal sub-template. See {{image}} for documentation.