summaryrefslogtreecommitdiff
path: root/admin/plugins/mime_image.php
blob: b13540815f2753346747cef7a9ef8cd5b2329e1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php

use Bitweaver\KernelTools;
require_once '../../../kernel/includes/setup_inc.php';
include_once KERNEL_PKG_INCLUDE_PATH . 'simple_form_functions_lib.php';

$gBitSystem->verifyPermission( 'p_admin' );

$settings = [
	'mime_image_panoramas' => [
		'label' => 'Panorama Images',
		'note'  => 'When users upload 360&deg; panoramic images, they can enable a flash viewer to view these. This can greatly enhance the image viewing experience for panoramic images. (<a class="external" href="http://pan0.net/fspp">example</a>)',
		'type'  => 'checkbox',
	],
];
$gBitSmarty->assign( 'settings', $settings );

$panWidth = [
	1500 => '1500 x 750',
	2000 => '2000 x 1000 (about 1MB)',
	2500 => '2500 x 1250',
	3000 => '3000 x 1500 (about 2MB)',
	3500 => '3500 x 1750',
	4000 => '4000 x 2000 (about 3-4MB)',
	4500 => '4500 x 2250',
	5000 => '5000 x 2500 (about 5-6MB)',
];
$gBitSmarty->assign( 'panWidth', $panWidth );

if( $gBitSystem->getConfig( 'image_processor' ) != 'magickwand' ) {
	$gBitSmarty->assign( 'image_processor_warning', true );
}

$feedback = [];
if( !empty( $_REQUEST['settings_store'] )) {
	foreach( $settings as $item => $data ) {
		if( $data['type'] == 'checkbox' ) {
			simple_set_toggle( $item, FISHEYE_PKG_NAME );
		} elseif( $data['type'] == 'numeric' ) {
			simple_set_int( $item, FISHEYE_PKG_NAME );
		} else {
			$gBitSystem->storeConfig( $item, !empty( $_REQUEST[$item] ) ? $_REQUEST[$item] : null, FISHEYE_PKG_NAME );
		}
	}
	simple_set_int( 'mime_image_panorama_width', $_REQUEST['mime_image_panorama_width'] );
}
$gBitSmarty->assign( 'feedback', $feedback );
$gBitSystem->display( 'bitpackage:liberty/mime/image/admin.tpl', KernelTools::tra( 'Image Plugin Settings' ), [ 'display_mode' => 'admin' ]);