Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 3ebfbca

Browse files
author
Jamie Snape
committed
Revise thumbnailcreator module configuration form and add install script
1 parent f06ed1f commit 3ebfbca

File tree

12 files changed

+126
-108
lines changed

12 files changed

+126
-108
lines changed

modules/thumbnailcreator/configs/module.ini

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,5 @@ fullname = "Thumbnail Creator"
55
description = "Create image thumbnails using the GD or ImageMagick extensions or the ImageMagick program"
66
category = "Imaging"
77
dependencies = scheduler
8-
version = "1.0.3"
9-
10-
; imagemagick folder
11-
imagemagick =
12-
13-
; if use thumbnailer
14-
useThumbnailer =
15-
16-
; thumbnailer folder
17-
thumbnailer =
18-
19-
; image formats (comma separated) that need thumbnailer to do preprocessing
20-
imageFormats = nrrd, mha
8+
uuid = "9cd14b7a-5e60-42ad-8752-20473ce9e3a7"
9+
version = "1.1.0"

modules/thumbnailcreator/constant/module.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,22 @@
1818
limitations under the License.
1919
=========================================================================*/
2020

21-
define('MIDAS_THUMBNAILCREATOR_USE_THUMBNAILER', 1);
22-
define('MIDAS_THUMBNAILCREATOR_NOT_USE_THUMBNAILER', 0);
23-
21+
define('MIDAS_THUMBNAILCREATOR_PROVIDER_KEY', 'provider');
22+
define('MIDAS_THUMBNAILCREATOR_PROVIDER_DEFAULT_VALUE', 'gd');
23+
define('MIDAS_THUMBNAILCREATOR_PROVIDER_NONE', 'none');
24+
define('MIDAS_THUMBNAILCREATOR_PROVIDER_GD', 'gd');
25+
define('MIDAS_THUMBNAILCREATOR_PROVIDER_IMAGICK', 'imagick');
26+
define('MIDAS_THUMBNAILCREATOR_PROVIDER_PHMAGICK', 'phmagick');
27+
define('MIDAS_THUMBNAILCREATOR_FORMAT_KEY', 'format');
28+
define('MIDAS_THUMBNAILCREATOR_FORMAT_DEFAULT_VALUE', 'png');
29+
define('MIDAS_THUMBNAILCREATOR_FORMAT_GIF', 'gif');
30+
define('MIDAS_THUMBNAILCREATOR_FORMAT_JPG', 'jpg');
31+
define('MIDAS_THUMBNAILCREATOR_FORMAT_PNG', 'png');
32+
define('MIDAS_THUMBNAILCREATOR_IMAGE_MAGICK_KEY', 'image_magick');
33+
define('MIDAS_THUMBNAILCREATOR_IMAGE_MAGICK_DEFAULT_VALUE', '');
34+
define('MIDAS_THUMBNAILCREATOR_USE_THUMBNAILER_KEY', 'use_thumbnailer');
35+
define('MIDAS_THUMBNAILCREATOR_USE_THUMBNAILER_DEFAULT_VALUE', 0);
36+
define('MIDAS_THUMBNAILCREATOR_THUMBNAILER_KEY', 'thumbnailer');
37+
define('MIDAS_THUMBNAILCREATOR_THUMBNAILER_DEFAULT_VALUE', '');
2438
define('MIDAS_THUMBNAILCREATOR_LARGE_THUMBNAIL_SIZE', 575);
2539
define('MIDAS_THUMBNAILCREATOR_SMALL_THUMBNAIL_SIZE', 100);

modules/thumbnailcreator/controllers/AdminController.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ public function indexAction()
3939
$values = $form->getValues();
4040

4141
foreach ($values as $key => $value) {
42-
$this->Setting->setConfig($key, $value, $this->moduleName);
42+
if ($value !== null) {
43+
$this->Setting->setConfig($key, $value, $this->moduleName);
44+
}
4345
}
4446
}
4547

@@ -50,7 +52,7 @@ public function indexAction()
5052
foreach ($elements as $element) {
5153
$name = $element->getName();
5254

53-
if ($name !== 'submit') {
55+
if ($name !== 'csrf' && $name !== 'submit') {
5456
$value = $this->Setting->getValueByName($name, $this->moduleName);
5557

5658
if (!is_null($value)) {
@@ -61,5 +63,6 @@ public function indexAction()
6163
}
6264

6365
$this->view->form = $form;
66+
session_start();
6467
}
6568
}

modules/thumbnailcreator/controllers/components/ImagemagickComponent.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ public function createThumbnailFromPath($name, $fullPath, $width, $height, $exac
8787
{
8888
/** @var SettingModel $settingModel */
8989
$settingModel = MidasLoader::loadModel('Setting');
90-
$provider = $settingModel->getValueByName('provider', $this->moduleName);
91-
$useThumbnailer = $settingModel->getValueByName('use_thumbnailer', $this->moduleName);
90+
$provider = $settingModel->getValueByName(MIDAS_THUMBNAILCREATOR_PROVIDER_KEY, $this->moduleName);
91+
$useThumbnailer = $settingModel->getValueByName(MIDAS_THUMBNAILCREATOR_USE_THUMBNAILER_KEY, $this->moduleName);
9292
$preprocessedFormats = array('mha', 'nrrd');
9393
$ext = strtolower(substr(strrchr($name, '.'), 1));
9494

@@ -103,10 +103,10 @@ public function createThumbnailFromPath($name, $fullPath, $width, $height, $exac
103103

104104
// create destination
105105
$tmpPath = UtilityComponent::getTempDirectory('thumbnailcreator');
106-
$format = $settingModel->getValueByName('format', $this->moduleName);
106+
$format = $settingModel->getValueByName(MIDAS_THUMBNAILCREATOR_FORMAT_KEY, $this->moduleName);
107107

108108
if ($format === 'jpeg') {
109-
$format = 'jpg';
109+
$format = MIDAS_THUMBNAILCREATOR_FORMAT_JPG;
110110
}
111111

112112
$destination = $tmpPath.'/'.mt_rand(1, 10000).'.'.$format;
@@ -118,7 +118,7 @@ public function createThumbnailFromPath($name, $fullPath, $width, $height, $exac
118118
$pathThumbnail = $destination;
119119

120120
if ($provider === 'phmagick') {
121-
$imageMagickPath = $settingModel->getValueByName('image_magick', $this->moduleName);
121+
$imageMagickPath = $settingModel->getValueByName(MIDAS_THUMBNAILCREATOR_IMAGE_MAGICK_KEY, $this->moduleName);
122122

123123
switch ($ext) {
124124
case 'pdf':
@@ -167,7 +167,7 @@ public function createThumbnailFromPath($name, $fullPath, $width, $height, $exac
167167
if (isset($preprocessedJpeg) && file_exists($preprocessedJpeg)) {
168168
unlink($preprocessedJpeg);
169169
}
170-
} elseif ($provider === 'gd' || $provider === 'imagick') {
170+
} elseif ($provider === MIDAS_THUMBNAILCREATOR_PROVIDER_GD || $provider === MIDAS_THUMBNAILCREATOR_PROVIDER_IMAGICK) {
171171
try {
172172
$manager = new \Intervention\Image\ImageManager(array('driver' => $provider));
173173
$image = $manager->make($fullPath);
@@ -212,15 +212,15 @@ public function preprocessByThumbnailer($name, $fullPath)
212212

213213
$copyDestination = $tmpPath.'/'.$name;
214214
copy($fullPath, $copyDestination);
215-
$jpegDestination = $tmpPath.'/'.$name.'.jpeg';
215+
$jpegDestination = $tmpPath.'/'.$name.'.jpg';
216216

217217
while (file_exists($jpegDestination)) {
218-
$jpegDestination = $tmpPath.'/'.$name.mt_rand(1, 10000).'.jpeg';
218+
$jpegDestination = $tmpPath.'/'.$name.mt_rand(1, 10000).'.jpg';
219219
}
220220

221221
/** @var SettingModel $settingModel */
222222
$settingModel = MidasLoader::loadModel('Setting');
223-
$thumbnailerPath = $settingModel->getValueByName('thumbnailcreator', $this->moduleName);
223+
$thumbnailerPath = $settingModel->getValueByName(MIDAS_THUMBNAILCREATOR_THUMBNAILER_KEY, $this->moduleName);
224224
$thumbnailerParams = array($copyDestination, $jpegDestination);
225225
$thumbnailerCmd = KWUtils::prepareExeccommand($thumbnailerPath, $thumbnailerParams);
226226

@@ -253,26 +253,26 @@ public function isImageMagickWorking()
253253
{
254254
/** @var SettingModel $settingModel */
255255
$settingModel = MidasLoader::loadModel('Setting');
256-
$provider = $settingModel->getValueByName('provider', $this->moduleName);
256+
$provider = $settingModel->getValueByName(MIDAS_THUMBNAILCREATOR_PROVIDER_KEY, $this->moduleName);
257257

258-
if ($provider === 'gd') {
258+
if ($provider === MIDAS_THUMBNAILCREATOR_PROVIDER_GD) {
259259
if (extension_loaded('gd')) {
260260
return array(true, 'GD PHP extension is loaded');
261261
}
262262

263263
return array(false, 'GD PHP extension is not loaded');
264264
}
265265

266-
if ($provider === 'imagick') {
266+
if ($provider === MIDAS_THUMBNAILCREATOR_PROVIDER_IMAGICK) {
267267
if (extension_loaded('imagick')) {
268268
return array(true, 'ImageMagick PHP extension is loaded');
269269
}
270270

271271
return array(false, 'ImageMagick PHP extension is not loaded');
272272
}
273273

274-
if ($provider === 'phmagick') {
275-
$imageMagickPath = $settingModel->getValueByName('image_magick', $this->moduleName);
274+
if ($provider === MIDAS_THUMBNAILCREATOR_PROVIDER_PHMAGICK) {
275+
$imageMagickPath = $settingModel->getValueByName(MIDAS_THUMBNAILCREATOR_IMAGE_MAGICK_KEY, $this->moduleName);
276276

277277
if (empty($imageMagickPath)) {
278278
return array(false, 'No ImageMagick path has been set');
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
/*=========================================================================
3+
MIDAS Server
4+
Copyright (c) Kitware SAS. 26 rue Louis Guérin. 69100 Villeurbanne, FRANCE
5+
All rights reserved.
6+
More information http://www.kitware.com
7+
8+
Licensed under the Apache License, Version 2.0 (the "License");
9+
you may not use this file except in compliance with the License.
10+
You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0.txt
13+
14+
Unless required by applicable law or agreed to in writing, software
15+
distributed under the License is distributed on an "AS IS" BASIS,
16+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
See the License for the specific language governing permissions and
18+
limitations under the License.
19+
=========================================================================*/
20+
21+
require_once BASE_PATH.'/modules/thumbnailcreator/constant/module.php';
22+
23+
/** Install the thumbnailcreator module. */
24+
class Thumbnailcreator_InstallScript extends MIDASModuleInstallScript
25+
{
26+
/** @var string */
27+
public $moduleName = 'thumbnailcreator';
28+
29+
/** Post database install. */
30+
public function postInstall()
31+
{
32+
/** @var SettingModel $settingModel */
33+
$settingModel = MidasLoader::loadModel('Setting');
34+
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_PROVIDER_KEY, MIDAS_THUMBNAILCREATOR_PROVIDER_DEFAULT_VALUE, $this->moduleName);
35+
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_FORMAT_KEY, MIDAS_THUMBNAILCREATOR_FORMAT_DEFAULT_VALUE, $this->moduleName);
36+
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_IMAGE_MAGICK_KEY, MIDAS_THUMBNAILCREATOR_IMAGE_MAGICK_DEFAULT_VALUE, $this->moduleName);
37+
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_USE_THUMBNAILER_KEY, MIDAS_THUMBNAILCREATOR_USE_THUMBNAILER_DEFAULT_VALUE, $this->moduleName);
38+
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_THUMBNAILER_KEY, MIDAS_THUMBNAILCREATOR_THUMBNAILER_DEFAULT_VALUE, $this->moduleName);
39+
}
40+
}
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- MIDAS Server. Copyright Kitware SAS. Licensed under the Apache License 2.0.
22

3-
-- MySQL database for the thumbnailcreator module, version 1.0.3
3+
-- MySQL database for the thumbnailcreator module, version 1.1.0
44

55
CREATE TABLE IF NOT EXISTS `thumbnailcreator_itemthumbnail` (
66
`itemthumbnail_id` bigint(20) NOT NULL AUTO_INCREMENT,
@@ -9,10 +9,3 @@ CREATE TABLE IF NOT EXISTS `thumbnailcreator_itemthumbnail` (
99
PRIMARY KEY (`itemthumbnail_id`),
1010
KEY (`item_id`)
1111
) DEFAULT CHARSET=utf8;
12-
13-
INSERT INTO `setting` (`module`, `name`, `value`) VALUES
14-
('thumbnailcreator', 'provider', 'gd'),
15-
('thumbnailcreator', 'format', 'jpg'),
16-
('thumbnailcreator', 'image_magick', ''),
17-
('thumbnailcreator', 'use_thumbnailer', '0'),
18-
('thumbnailcreator', 'thumbnailer', '');
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- MIDAS Server. Copyright Kitware SAS. Licensed under the Apache License 2.0.
22

3-
-- PostgreSQL database for the thumbnailcreator module, version 1.0.3
3+
-- PostgreSQL database for the thumbnailcreator module, version 1.1.0
44

55
SET client_encoding = 'UTF8';
66
SET default_with_oids = FALSE;
@@ -12,10 +12,3 @@ CREATE TABLE IF NOT EXISTS "thumbnailcreator_itemthumbnail" (
1212
);
1313

1414
CREATE INDEX "thumbnailcreator_itemthumbnail_item_id" ON "thumbnailcreator_itemthumbnail" ("item_id");
15-
16-
INSERT INTO "setting" ("module", "name", "value") VALUES
17-
('thumbnailcreator', 'provider', 'gd'),
18-
('thumbnailcreator', 'format', 'jpg'),
19-
('thumbnailcreator', 'image_magick', ''),
20-
('thumbnailcreator', 'use_thumbnailer', 0),
21-
('thumbnailcreator', 'thumbnailer', '');
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- MIDAS Server. Copyright Kitware SAS. Licensed under the Apache License 2.0.
22

3-
-- SQLite database for the thumbnailcreator module, version 1.0.3
3+
-- SQLite database for the thumbnailcreator module, version 1.1.0
44

55
CREATE TABLE IF NOT EXISTS "thumbnailcreator_itemthumbnail" (
66
"itemthumbnail_id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
@@ -9,10 +9,3 @@ CREATE TABLE IF NOT EXISTS "thumbnailcreator_itemthumbnail" (
99
);
1010

1111
CREATE INDEX IF NOT EXISTS "thumbnailcreator_itemthumbnail_item_id_idx" ON "thumbnailcreator_itemthumbnail" ("item_id");
12-
13-
INSERT INTO "setting" ("module", "name", "value") VALUES
14-
('thumbnailcreator', 'provider', 'gd'),
15-
('thumbnailcreator', 'format', 'jpg'),
16-
('thumbnailcreator', 'image_magick', ''),
17-
('thumbnailcreator', 'use_thumbnailer', 0),
18-
('thumbnailcreator', 'thumbnailer', '');

modules/thumbnailcreator/database/upgrade/1.0.3.php renamed to modules/thumbnailcreator/database/upgrade/1.1.0.php

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
limitations under the License.
1919
=========================================================================*/
2020

21-
/** Upgrade the thumbnailcreator module to version 1.0.3. */
22-
class Thumbnailcreator_Upgrade_1_0_3 extends MIDASUpgrade
21+
/** Upgrade the thumbnailcreator module to version 1.1.0. */
22+
class Thumbnailcreator_Upgrade_1_1_0 extends MIDASUpgrade
2323
{
2424
/** @var string */
2525
public $moduleName = 'thumbnailcreator';
@@ -29,23 +29,15 @@ public function postUpgrade()
2929
{
3030
/** @var SettingModel $settingModel */
3131
$settingModel = MidasLoader::loadModel('Setting');
32-
$settingModel->setConfig('provider', 'phmagick', $this->moduleName);
33-
$settingModel->setConfig('format', 'jpg', $this->moduleName);
34-
3532
$configPath = LOCAL_CONFIGS_PATH.DIRECTORY_SEPARATOR.$this->moduleName.'.local.ini';
3633

3734
if (file_exists($configPath)) {
3835
$config = new Zend_Config_Ini($configPath, 'global');
39-
40-
if ($config->get('imagemagick')) {
41-
$settingModel->setConfig('image_magick', $config->get('imagemagick'), $this->moduleName);
42-
}
43-
44-
$settingModel->setConfig('use_thumbnailer', $config->get('useThumbnailer', 0), $this->moduleName);
45-
46-
if ($config->get('thumbnailer')) {
47-
$settingModel->setConfig('thumbnailer', $config->get('thumbnailer'), $this->moduleName);
48-
}
36+
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_PROVIDER_KEY, MIDAS_THUMBNAILCREATOR_PROVIDER_PHMAGICK, $this->moduleName);
37+
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_FORMAT_KEY, MIDAS_THUMBNAILCREATOR_FORMAT_JPG, $this->moduleName);
38+
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_IMAGE_MAGICK_KEY, $config->get('imagemagick', MIDAS_THUMBNAILCREATOR_IMAGE_MAGICK_DEFAULT_VALUE), $this->moduleName);
39+
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_USE_THUMBNAILER_KEY, $config->get('useThumbnailer', MIDAS_THUMBNAILCREATOR_USE_THUMBNAILER_DEFAULT_VALUE), $this->moduleName);
40+
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_THUMBNAILER_KEY, $config->get('thumbnailer', MIDAS_THUMBNAILCREATOR_THUMBNAILER_DEFAULT_VALUE), $this->moduleName);
4941

5042
$config = new Zend_Config_Ini($configPath, null, true);
5143
unset($config->global->imageFormats);
@@ -58,7 +50,11 @@ public function postUpgrade()
5850
$writer->setFilename($configPath);
5951
$writer->write();
6052
} else {
61-
$settingModel->setConfig('use_thumbnailer', 0, $this->moduleName);
53+
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_PROVIDER_KEY, MIDAS_THUMBNAILCREATOR_PROVIDER_DEFAULT_VALUE, $this->moduleName);
54+
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_FORMAT_KEY, MIDAS_THUMBNAILCREATOR_FORMAT_DEFAULT_VALUE, $this->moduleName);
55+
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_IMAGE_MAGICK_KEY, MIDAS_THUMBNAILCREATOR_IMAGE_MAGICK_DEFAULT_VALUE, $this->moduleName);
56+
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_USE_THUMBNAILER_KEY, MIDAS_THUMBNAILCREATOR_USE_THUMBNAILER_DEFAULT_VALUE, $this->moduleName);
57+
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_THUMBNAILER_KEY, MIDAS_THUMBNAILCREATOR_THUMBNAILER_DEFAULT_VALUE, $this->moduleName);
6258
}
6359
}
6460
}

modules/thumbnailcreator/forms/Admin.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,47 +24,51 @@ class Thumbnailcreator_Form_Admin extends Zend_Form
2424
/** Initialize this form. */
2525
public function init()
2626
{
27-
$this->setName('thumbnailcreator_config');
27+
$this->setName('thumbnailcreator_admin');
2828
$this->setMethod('POST');
2929

30-
$provider = new Zend_Form_Element_Select('provider');
30+
$csrf = new Midas_Form_Element_Hash('csrf');
31+
$csrf->setSalt('tKHLsBvnbLVYaWJNhrrafrBz');
32+
$csrf->setDecorators(array('ViewHelper'));
33+
34+
$provider = new Zend_Form_Element_Select(MIDAS_THUMBNAILCREATOR_PROVIDER_KEY);
3135
$provider->setLabel('Provider');
32-
$provider->addMultiOption('none', 'None');
3336
$provider->setRequired(true);
3437
$provider->addValidator('NotEmpty', true);
38+
$provider->addMultiOption(MIDAS_THUMBNAILCREATOR_PROVIDER_NONE, 'None');
3539

3640
if (extension_loaded('gd')) {
37-
$provider->addMultiOption('gd', 'GD PHP Extension');
41+
$provider->addMultiOption(MIDAS_THUMBNAILCREATOR_PROVIDER_GD, 'GD PHP Extension');
3842
}
3943

4044
if (extension_loaded('imagick')) {
41-
$provider->addMultiOption('imagick', 'ImageMagick PHP Extension');
45+
$provider->addMultiOption(MIDAS_THUMBNAILCREATOR_PROVIDER_IMAGICK, 'ImageMagick PHP Extension');
4246
}
4347

44-
$isAppEngine = class_exists('\google\appengine\api\app_identity\AppIdentityService', false);
45-
46-
if (!$isAppEngine) {
47-
$provider->addMultiOption('phmagick', 'ImageMagick Program');
48-
}
48+
$provider->addMultiOption(MIDAS_THUMBNAILCREATOR_PROVIDER_PHMAGICK, 'ImageMagick Program');
4949

50-
$format = new Zend_Form_Element_Select('format');
50+
$format = new Zend_Form_Element_Select(MIDAS_THUMBNAILCREATOR_FORMAT_KEY);
5151
$format->setLabel('Format');
52-
$format->addMultiOption('gif', 'GIF');
53-
$format->addMultiOption('jpg', 'JPEG');
54-
$format->addMultiOption('png', 'PNG');
5552
$format->setRequired(true);
5653
$format->addValidator('NotEmpty', true);
54+
$format->addMultiOptions(
55+
array(
56+
MIDAS_THUMBNAILCREATOR_FORMAT_GIF => 'GIF',
57+
MIDAS_THUMBNAILCREATOR_FORMAT_JPG => 'JPEG',
58+
MIDAS_THUMBNAILCREATOR_FORMAT_PNG => 'PNG',
59+
)
60+
);
5761

5862
$this->addDisplayGroup(array($provider, $format), 'global');
5963

60-
$imageMagick = new Zend_Form_Element_Text('image_magick');
64+
$imageMagick = new Zend_Form_Element_Text(MIDAS_THUMBNAILCREATOR_IMAGE_MAGICK_KEY);
6165
$imageMagick->setLabel('ImageMagick program location (path)');
6266
$imageMagick->addValidator('NotEmpty', true);
6367

64-
$useThumbnailer = new Zend_Form_Element_Checkbox('use_thumbnailer');
68+
$useThumbnailer = new Zend_Form_Element_Checkbox(MIDAS_THUMBNAILCREATOR_USE_THUMBNAILER_KEY);
6569
$useThumbnailer->setLabel('Have thumbnailer and want to use it to support more image formats');
6670

67-
$thumbnailer = new Zend_Form_Element_Text('thumbnailer');
71+
$thumbnailer = new Zend_Form_Element_Text(MIDAS_THUMBNAILCREATOR_THUMBNAILER_KEY);
6872
$thumbnailer->setLabel('Thumbnailer program location (path)');
6973
$thumbnailer->addValidator('NotEmpty', true);
7074

@@ -73,10 +77,6 @@ public function init()
7377
$submit = new Zend_Form_Element_Submit('submit');
7478
$submit->setLabel('Save');
7579

76-
if ($isAppEngine) {
77-
$this->addElements(array($provider, $format, $submit));
78-
} else {
79-
$this->addElements(array($provider, $format, $imageMagick, $useThumbnailer, $thumbnailer, $submit));
80-
}
80+
$this->addElements(array($csrf, $provider, $format, $imageMagick, $useThumbnailer, $thumbnailer, $submit));
8181
}
8282
}

0 commit comments

Comments
 (0)