mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
Allow to rotate thumbnails on all type of records
This commit is contained in:
@@ -65,26 +65,23 @@ class Tools implements ControllerProviderInterface
|
|||||||
});
|
});
|
||||||
|
|
||||||
$controllers->post('/rotate/', function (Application $app, Request $request) {
|
$controllers->post('/rotate/', function (Application $app, Request $request) {
|
||||||
$return = ['success' => true, 'errorMessage' => ''];
|
|
||||||
|
|
||||||
$records = RecordsRequest::fromRequest($app, $request, false);
|
$records = RecordsRequest::fromRequest($app, $request, false);
|
||||||
|
$rotation = in_array($request->request->get('rotation'), array('-90', '90', '180')) ? $request->request->get('rotation', 90) : 90;
|
||||||
$rotation = in_array($request->request->get('rotation'), ['-90', '90', '180']) ? $request->request->get('rotation', 90) : 90;
|
|
||||||
|
|
||||||
foreach ($records as $record) {
|
foreach ($records as $record) {
|
||||||
foreach ($record->get_subdefs() as $name => $subdef) {
|
foreach ($record->get_subdefs() as $subdef) {
|
||||||
if ($name == 'document')
|
if ($subdef->get_type() !== \media_subdef::TYPE_IMAGE) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$subdef->rotate($rotation, $app['media-alchemyst'], $app['mediavorus']);
|
$subdef->rotate($rotation, $app['media-alchemyst'], $app['mediavorus']);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $app->json($return);
|
return $app->json(array('success' => true, 'errorMessage' => ''));
|
||||||
})->bind('prod_tools_rotate');
|
})->bind('prod_tools_rotate');
|
||||||
|
|
||||||
$controllers->post('/image/', function (Application $app, Request $request) {
|
$controllers->post('/image/', function (Application $app, Request $request) {
|
||||||
|
@@ -19,14 +19,6 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{# image section #}
|
|
||||||
{% set allowRotate = '0' %}
|
|
||||||
{% for record in records %}
|
|
||||||
{% if record.get_type() == 'image' %}
|
|
||||||
{% set allowRotate = '1' %}
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
<div id='prod-tool-box' class="PNB10">
|
<div id='prod-tool-box' class="PNB10">
|
||||||
|
|
||||||
{# jquery Tabs #}
|
{# jquery Tabs #}
|
||||||
@@ -50,14 +42,12 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if allowRotate == 1%}
|
<li>
|
||||||
<li>
|
<a href="#image">
|
||||||
<a href="#image">
|
{{ "image tool" | trans }}
|
||||||
{{ "image tool" | trans }}
|
</a>
|
||||||
</a>
|
</li>
|
||||||
</li>
|
{% if selectionLength == 1 and (app['phraseanet.registry'].get('GV_seeOngChgDoc') or app['phraseanet.registry'].get('GV_seeNewThumb')) %}
|
||||||
{% endif %}
|
|
||||||
{% if selectionLength == 1 and (app['conf'].get(['registry', 'modules', 'doc-substitution']) or app['conf'].get(['registry', 'modules', 'thumb-substitution'])) %}
|
|
||||||
<li>
|
<li>
|
||||||
<a href="#substitution">
|
<a href="#substitution">
|
||||||
{{ "substitution" | trans }}
|
{{ "substitution" | trans }}
|
||||||
@@ -242,31 +232,32 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if allowRotate == 1 %}
|
<div id="image" class="tabBox">
|
||||||
<div id="image" class="tabBox">
|
<div class="text-info">
|
||||||
<form name="formpushdoc" action="{{ path('prod_tools_rotate') }}" method="post">
|
<i class=" icon-info-sign"></i> {% trans %}Changes for rotation will be applied only on the sub-definitions of "image" type.{% endtrans %}
|
||||||
<fieldset style='border:1px solid #999;padding:20px;'>
|
</div>
|
||||||
<legend style='color:#EEE'> <b>{{ "image rotation" | trans }}</b> </legend>
|
<form name="formpushdoc" action="{{ path('prod_tools_rotate') }}" method="post">
|
||||||
<label for="ROTA_90" class="radio">
|
<fieldset style='border:1px solid #999;padding:20px;'>
|
||||||
<input type="radio" name="rotation" id="ROTA_90" value="90" checked="checked">
|
<legend style='color:#EEE'> <b>{% trans "image rotation" %}</b> </legend>
|
||||||
{{ "rotation 90 degres horaire" | trans }}
|
<label for="ROTA_90" class="radio">
|
||||||
</label>
|
<input type="radio" name="rotation" id="ROTA_90" value="90" checked="checked">
|
||||||
<br />
|
{{ "rotation 90 degres horaire" | trans }}
|
||||||
<label for="ROTA_C90" class="radio">
|
</label>
|
||||||
<input type="radio" name="rotation" id="ROTA_C90" value="-90">
|
<br />
|
||||||
{{ "rotation 90 degres anti-horaires" | trans }}
|
<label for="ROTA_C90" class="radio">
|
||||||
</label>
|
<input type="radio" name="rotation" id="ROTA_C90" value="-90">
|
||||||
<input type="hidden" name="lst" value="{{records.serializedList()}}" />
|
{{ "rotation 90 degres anti-horaires" | trans }}
|
||||||
<input type="hidden" name="element" value="" />
|
</label>
|
||||||
<input type="hidden" name="cchd" value="" />
|
<input type="hidden" name="lst" value="{{records.serializedList()}}" />
|
||||||
</fieldset>
|
<input type="hidden" name="element" value="" />
|
||||||
<div style='text-align:right;padding-top:10px;'>
|
<input type="hidden" name="cchd" value="" />
|
||||||
<button class="action_submiter btn btn-inverse">{{ "validate" | trans }}</button>
|
</fieldset>
|
||||||
<button class="action_cancel btn btn-inverse">{{ "cancel" | trans }}</button>
|
<div style='text-align:right;padding-top:10px;'>
|
||||||
</div>
|
<button class="action_submiter btn btn-inverse">{% trans "validate" %}</button>
|
||||||
</form>
|
<button class="action_cancel btn btn-inverse">{% trans "cancel" %}</button>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
{# hd sub section #}
|
{# hd sub section #}
|
||||||
{% if selectionLength == 1 and (app['conf'].get(['registry', 'modules', 'doc-substitution']) or app['conf'].get(['registry', 'modules', 'thumb-substitution'])) %}
|
{% if selectionLength == 1 and (app['conf'].get(['registry', 'modules', 'doc-substitution']) or app['conf'].get(['registry', 'modules', 'thumb-substitution'])) %}
|
||||||
|
Reference in New Issue
Block a user