Skip to content

Commit a8e8edc

Browse files
committed
New setting to customize embedded images naming
1 parent ce44715 commit a8e8edc

6 files changed

Lines changed: 14 additions & 2 deletions

File tree

src/Controllers/ConfigurationsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function index()
2828
'list_owner_notification', 'status_owner_notification', 'email.template', 'email.owner.newticket.template', 'email.account.name', 'email.account.mailbox', 'custom_recipients', ];
2929
$tickets_section = ['default_priority_id', 'default_status_id', 'default_close_status_id', 'default_reopen_status_id',
3030
'attachments_ticket_max_size', 'attachments_ticket_max_files_num', 'attachments_mimes',
31-
'attachments_path', 'thumbnails_path', 'oldest_year', 'html_replacements', 'use_default_status_id', 'delete_modal_type', ];
31+
'attachments_path', 'thumbnails_path', 'oldest_year', 'html_replacements', 'use_default_status_id', 'delete_modal_type', 'embedded_image_prefix'];
3232
$perms_section = ['agent_restrict', 'close_ticket_perm', 'reopen_ticket_perm'];
3333
$editor_section = ['editor_enabled', 'editor_html_highlighter', 'codemirror_theme',
3434
'summernote_locale', 'summernote_options_json_file', 'summernote_options_user', 'purifier_config', ];

src/Seeds/SettingsTableSeeder.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,14 @@ public function getDefaults()
297297
*/
298298
'delete_modal_type' => 'builtin',
299299

300+
/*
301+
* Prefix for embedded images: Embedded images in text fields with resolutions above specified limit
302+
* get transformed in an attachment with an image thumbnail. That attachment name is
303+
* formed by this field value and an automatic number
304+
* Default: embedded_image
305+
*/
306+
'embedded_image_prefix' => 'image',
307+
300308
/* ------------------ JS EDITOR ------------------ */
301309

302310
/*

src/Traits/Attachments.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected function createAttachmentsFrom($html, $ticket, $comment = false, $coun
8282
$node->setAttribute('class', 'summernote_embedded_image');
8383
} else {
8484
// Create filename
85-
$original_filename = 'embedded_image_'.($i + $count).'.png';
85+
$original_filename = Setting::grab('embedded_image_prefix') . '_' . ($i + $count).'.png';
8686

8787
$file_name = $this->makeFilename($original_filename.date('YmdHis', time()), $ticket->id.'_embedded', '');
8888

src/Translations/ca/settings.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
'html_replacements' => 'Reemplaços automàtics per als camps de contingut i actuació',
4949
'default_priority_id' => 'La prioritat per defecte dels tiquets nous',
5050
'use_default_status_id' => 'Permetre o no d\'assignar l\'estat default_status_id a qualsevol tiquet',
51+
'embedded_image_prefix' => 'Les imatges incrustades amb resolució per damunt del límit són transformades en un fitxer adjunt que té de nom aquest prefix amb una numeració automàtica',
5152

5253
// notificacions
5354
'email.template' => 'La plantilla blade d\'email que totes les notificacions extenen',

src/Translations/en/settings.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
'html_replacements' => 'Automatic string replacements for content and intervention HTML fields',
4949
'default_priority_id' => 'The default priority for new tickets',
5050
'use_default_status_id' => 'Whether to allow or not the default_status_id to be assignable in any ticket',
51+
'embedded_image_prefix' => 'Embedded images with resolution above limit get transformed in an attachment named using this prefix and an automatic numeration',
5152

5253
// notifications
5354
'email.template' => 'The email blade template that all notifications extend',

src/Translations/es/settings.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@
6666
6767
<p>Opciones: <code>modal</code>, <code>integrada</code></p>
6868
ENDHTML
69+
, 'embedded_image_prefix' => 'Las imágenes incrustadas con resolución por encima del límite son transformadas en un fichero adjunto que tiene de nombre este prefijo con una numeración automática',
70+
6971

7072
/* ------------------ JS EDITOR ------------------ */, 'editor_enabled' => <<<'ENDHTML'
7173
<p>Activar editor summernote en áreas de texto</p>

0 commit comments

Comments
 (0)