Make image size in table values settable by env

This commit is contained in:
barisgit 2025-08-03 22:05:17 +02:00
parent 8b417d6441
commit 886def3527
5 changed files with 19 additions and 3 deletions

3
.env
View file

@ -111,6 +111,9 @@ TABLE_DEFAULT_PAGE_SIZE=50
# Configure which columns will be visible by default in the parts table (and in which order).
# This is a comma separated list of column names. See documentation for available values.
TABLE_PARTS_DEFAULT_COLUMNS=name,description,category,footprint,manufacturer,storage_location,amount
# The minimum and maximum size of preview images in tables (in pixels). Valid range: 10-100
TABLE_IMAGE_PREVIEW_MIN_SIZE=10
TABLE_IMAGE_PREVIEW_MAX_SIZE=30
##################################################################################
# Info provider settings

View file

@ -18,8 +18,8 @@
*/
.hoverpic {
min-width: 10px;
max-width: 30px;
min-width: var(--table-image-preview-min-size, 10px);
max-width: var(--table-image-preview-max-size, 30px);
display: block;
margin-left: auto;
margin-right: auto;
@ -49,7 +49,7 @@
}
.part-table-image {
max-height: 40px;
max-height: var(--table-image-preview-max-size, 30px);
object-fit: contain;
}

View file

@ -22,6 +22,8 @@ twig:
saml_enabled: '%partdb.saml.enabled%'
part_preview_generator: '@App\Services\Attachments\PartPreviewGenerator'
img_overlay: '%partdb.show_part_image_overlay%'
table_image_preview_min_size: '%partdb.table.image_preview_min_size%'
table_image_preview_max_size: '%partdb.table.image_preview_max_size%'
when@test:
twig:

View file

@ -58,6 +58,8 @@ parameters:
######################################################################################################################
partdb.table.default_page_size: '%env(int:TABLE_DEFAULT_PAGE_SIZE)%' # The default number of entries shown per page in tables
partdb.table.parts.default_columns: '%env(trim:string:TABLE_PARTS_DEFAULT_COLUMNS)%' # The default columns in part tables and their order
partdb.table.image_preview_min_size: '%env(int:TABLE_IMAGE_PREVIEW_MIN_SIZE)%' # The minimum size of preview images in tables (in pixels)
partdb.table.image_preview_max_size: '%env(int:TABLE_IMAGE_PREVIEW_MAX_SIZE)%' # The maximum size of preview images in tables (in pixels)
######################################################################################################################
# Sidebar
@ -134,6 +136,8 @@ parameters:
env(ALLOW_EMAIL_PW_RESET): 0
env(TABLE_DEFAULT_PAGE_SIZE): 50
env(TABLE_IMAGE_PREVIEW_MIN_SIZE): 10
env(TABLE_IMAGE_PREVIEW_MAX_SIZE): 30
env(TRUSTED_PROXIES): '127.0.0.1' #By default trust only our own server
env(TRUSTED_HOSTS): '' # Trust all host names by default

View file

@ -53,6 +53,13 @@
{% endif %}
{{ encore_entry_link_tags('app') }}
<style>
:root {
--table-image-preview-min-size: {{ table_image_preview_min_size }}px;
--table-image-preview-max-size: {{ table_image_preview_max_size }}px;
}
</style>
{% endblock %}
{% block javascripts %}