use base64_encode filter rather than function

This commit is contained in:
Andy Miller
2021-05-13 12:49:59 -06:00
parent c2583ee259
commit 13dfe58feb
2 changed files with 4 additions and 4 deletions

View File

@@ -37,18 +37,18 @@
{% set blueprint_name = type ~ '/' ~ blueprint_name %}
{% set real_path = (value.thumb ?? global.context.media[path].relativePath ?? global.form.getPagePathFromToken(path) ?? global.admin.getPagePathFromToken(path))|ltrim('/') %}
{% endif %}
{% set blueprint = base64_encode(blueprint_name) %}
{% set blueprint = blueprint_name|base64_encode %}
{% set remove = global.file_task_remove ? global.file_url_remove : uri.addNonce(
global.file_url_remove ~
'/media.json' ~
'/task' ~ config.system.param_sep ~ 'removeFileFromBlueprint' ~
'/proute' ~ config.system.param_sep ~ base64_encode(route) ~
'/proute' ~ config.system.param_sep ~ (route|base64_encode) ~
'/blueprint' ~ config.system.param_sep ~ blueprint ~
'/type' ~ config.system.param_sep ~ type ~
'/field' ~ config.system.param_sep ~ files.name ~
'/path' ~ config.system.param_sep ~ base64_encode(value.path), 'admin-form', 'admin-nonce') %}
'/path' ~ config.system.param_sep ~ (value.path|base64_encode), 'admin-form', 'admin-nonce') %}
{% set file = value|merge({remove: remove, path: value.thumb_url ?? (uri.rootUrl == '/' ? '/' : uri.rootUrl ~ '/' ~ real_path) }) %}
<div class="hidden" data-file="{{ file|json_encode|e('html_attr') }}"></div>

View File

@@ -6,7 +6,7 @@
{% if the_file.exists and the_file.display() is not empty %}
<div class="card-item">
<div class="admin-media-details">
<a href="{% if is_modal %}#{% else %}{{ admin_route('/media-manager/' ~ base64_encode(the_file.filepath)) }}{% endif %}" class="js__media-element" data-file-url="{{ file.page_route ~ '/' ~ file.title }}">
<a href="{% if is_modal %}#{% else %}{{ admin_route('/media-manager/' ~ the_file.filepath|base64_encode) }}{% endif %}" class="js__media-element" data-file-url="{{ file.page_route ~ '/' ~ file.title }}">
{% set thumbnail = the_file.display(the_file.extension == 'svg' ? 'source' : 'thumbnail') %}
{% if thumbnail %}
<img src="{{thumbnail.cropZoom(250, 250).url}}" />