aboutsummaryrefslogtreecommitdiff
path: root/mod/lightpics/views/default/admin/settings/photos
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2013-11-09 16:22:50 +0100
committerSem <sembrestels@riseup.net>2013-11-09 16:22:50 +0100
commitf448cd91f9ecebea37daf40aada2fa1a20200817 (patch)
tree4636059da6a1be133a4974e5098b7c1e08944dd5 /mod/lightpics/views/default/admin/settings/photos
parent52335325e5ea8c89c711e1ba40d9ac1657004e61 (diff)
parent324f39c3a9aa41e9e23bafba38882a2b72f62441 (diff)
downloadelgg-f448cd91f9ecebea37daf40aada2fa1a20200817.tar.gz
elgg-f448cd91f9ecebea37daf40aada2fa1a20200817.tar.bz2
Add 'mod/lightpics/' from commit '324f39c3a9aa41e9e23bafba38882a2b72f62441'
git-subtree-dir: mod/lightpics git-subtree-mainline: 52335325e5ea8c89c711e1ba40d9ac1657004e61 git-subtree-split: 324f39c3a9aa41e9e23bafba38882a2b72f62441
Diffstat (limited to 'mod/lightpics/views/default/admin/settings/photos')
-rw-r--r--mod/lightpics/views/default/admin/settings/photos/help.php14
-rw-r--r--mod/lightpics/views/default/admin/settings/photos/image_lib.php38
-rw-r--r--mod/lightpics/views/default/admin/settings/photos/server_config.php14
-rw-r--r--mod/lightpics/views/default/admin/settings/photos/server_info.php120
-rw-r--r--mod/lightpics/views/default/admin/settings/photos/settings.php18
-rw-r--r--mod/lightpics/views/default/admin/settings/photos/thumbnail.php54
6 files changed, 258 insertions, 0 deletions
diff --git a/mod/lightpics/views/default/admin/settings/photos/help.php b/mod/lightpics/views/default/admin/settings/photos/help.php
new file mode 100644
index 000000000..1e5bdd254
--- /dev/null
+++ b/mod/lightpics/views/default/admin/settings/photos/help.php
@@ -0,0 +1,14 @@
+<?php
+/**
+ * Tidypics Help
+ *
+ */
+
+elgg_load_library('elgg:markdown');
+
+$faq = elgg_get_plugins_path() . 'lightpics/FAQ.txt';
+$text = Markdown(file_get_contents($faq));
+
+$content = "<div class=\"elgg-markdown\">$text</div>";
+
+echo elgg_view_module('inline', elgg_echo('tidypics:settings:help'), $content);
diff --git a/mod/lightpics/views/default/admin/settings/photos/image_lib.php b/mod/lightpics/views/default/admin/settings/photos/image_lib.php
new file mode 100644
index 000000000..6e519b607
--- /dev/null
+++ b/mod/lightpics/views/default/admin/settings/photos/image_lib.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Test the location of ImageMagick
+ */
+
+$content .= '<p>' . elgg_echo('tidypics:lib_tools:testing') . '</p>';
+$content .= '<p><label>' . elgg_echo('tidypics:settings:im_path');
+$content .= elgg_view('input/text', array(
+ 'name' => 'im_location'
+));
+$content .= '</p><p>';
+$content .= elgg_view('input/submit', array(
+ 'value' => elgg_echo('submit'),
+ 'id' => 'tidypics-im-test'
+));
+$content .= '</p>';
+$content .= '<p id="tidypics-im-results"></p>';
+
+echo elgg_view_module('inline', 'ImageMagick', $content);
+
+?>
+<script type="text/javascript">
+ $(function() {
+ $('#tidypics-im-test').click(function() {
+ var loc = $('input[name=im_location]').val();
+ $("#tidypics-im-results").html("");
+ $.ajax({
+ type: "GET",
+ url: elgg.normalize_url('mod/tidypics/actions/photos/admin/imtest.php'),
+ data: {location: loc},
+ cache: false,
+ success: function(html){
+ $("#tidypics-im-results").html(html);
+ }
+ });
+ });
+ });
+</script>
diff --git a/mod/lightpics/views/default/admin/settings/photos/server_config.php b/mod/lightpics/views/default/admin/settings/photos/server_config.php
new file mode 100644
index 000000000..b4fe552ec
--- /dev/null
+++ b/mod/lightpics/views/default/admin/settings/photos/server_config.php
@@ -0,0 +1,14 @@
+<?php
+/**
+ * Tidypics server configuration
+ *
+ */
+
+elgg_load_library('elgg:markdown');
+
+$faq = elgg_get_plugins_path() . 'lightpics/CONFIG.txt';
+$text = Markdown(file_get_contents($faq));
+
+$content = "<div class=\"elgg-markdown\">$text</div>";
+
+echo elgg_view_module('inline', elgg_echo('tidypics:server_config'), $content);
diff --git a/mod/lightpics/views/default/admin/settings/photos/server_info.php b/mod/lightpics/views/default/admin/settings/photos/server_info.php
new file mode 100644
index 000000000..c100b0de2
--- /dev/null
+++ b/mod/lightpics/views/default/admin/settings/photos/server_info.php
@@ -0,0 +1,120 @@
+<?php
+/**
+ * Tidypics server analysis
+ */
+
+function tp_readable_size($bytes) {
+ if (strpos($bytes, 'M')) {
+ return $bytes . 'B';
+ }
+
+ $size = $bytes / 1024;
+ if ($size < 1024) {
+ $size = number_format($size, 2);
+ $size .= ' KB';
+ } else {
+ $size = $size / 1024;
+ if ($size < 1024) {
+ $size = number_format($size, 2);
+ $size .= ' MB';
+ } else {
+ $size = $size / 1024;
+ $size = number_format($size, 2);
+ $size .= ' GB';
+ }
+ }
+ return $size;
+}
+
+$disablefunc = explode(',', ini_get('disable_functions'));
+$exec_avail = elgg_echo('tidypics:disabled');
+if (is_callable('exec') && !in_array('exec',$disablefunc)) {
+ $exec_avail = elgg_echo('tidypics:enabled');
+}
+
+ob_start();
+
+?>
+<table class="elgg-table-alt">
+ <tr>
+ <td><?php echo elgg_echo('tidypics:server_info:php_version'); ?></td>
+ <td><?php echo phpversion(); ?></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>GD</td>
+ <td><?php echo (extension_loaded('gd')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td>
+ <td><?php echo elgg_echo('tidypics:server_info:gd_desc'); ?></td>
+ </tr>
+ <tr>
+ <td>imagick</td>
+ <td><?php echo (extension_loaded('imagick')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>exec()</td>
+ <td><?php echo $exec_avail; ?></td>
+ <td><?php echo elgg_echo('tidypics:server_info:exec_desc'); ?></td>
+ </tr>
+ <tr>
+ <td><?php echo elgg_echo('tidypics:server_info:memory_limit'); ?></td>
+ <td><?php echo tp_readable_size(ini_get('memory_limit')); ?></td>
+ <td><?php echo elgg_echo('tidypics:server_info:memory_limit_desc'); ?></td>
+ </tr>
+ <tr>
+ <td><?php echo elgg_echo('tidypics:server_info:peak_usage'); ?></td>
+ <td><?php if (function_exists('memory_get_peak_usage')) echo tp_readable_size(memory_get_peak_usage()); ?></td>
+ <td><?php echo elgg_echo('tidypics:server_info:peak_usage_desc'); ?></td>
+ </tr>
+ <tr>
+ <td><?php echo elgg_echo('tidypics:server_info:upload_max_filesize'); ?></td>
+ <td><?php echo tp_readable_size(ini_get('upload_max_filesize')); ?></td>
+ <td><?php echo elgg_echo('tidypics:server_info:upload_max_filesize_desc'); ?></td>
+ </tr>
+ <tr>
+ <td><?php echo elgg_echo('tidypics:server_info:post_max_size'); ?></td>
+ <td><?php echo tp_readable_size(ini_get('post_max_size')); ?></td>
+ <td><?php echo elgg_echo('tidypics:server_info:post_max_size_desc'); ?></td>
+ </tr>
+ <tr>
+ <td><?php echo elgg_echo('tidypics:server_info:max_input_time'); ?></td>
+ <td><?php echo ini_get('max_input_time'); ?>s</td>
+ <td><?php echo elgg_echo('tidypics:server_info:max_input_time_desc'); ?></td>
+ </tr>
+ <tr>
+ <td><?php echo elgg_echo('tidypics:server_info:max_execution_time'); ?></td>
+ <td><?php echo ini_get('max_execution_time'); ?> s</td>
+ <td><?php echo elgg_echo('tidypics:server_info:max_execution_time_desc'); ?></td>
+ </tr>
+ <tr>
+ <td>GD imagejpeg</td>
+ <td><?php echo (is_callable('imagejpeg')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>GD imagepng</td>
+ <td><?php echo (is_callable('imagepng')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>GD imagegif</td>
+ <td><?php echo (is_callable('imagegif')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>EXIF</td>
+ <td><?php echo (is_callable('exif_read_data')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td><?php echo elgg_echo('tidypics:server_info:use_only_cookies'); ?></td>
+ <td><?php echo (ini_get('session.use_only_cookies')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td>
+ <td><?php echo elgg_echo('tidypics:server_info:use_only_cookies_desc'); ?></td>
+ </tr>
+</table>
+
+<?php
+
+$content = ob_get_clean();
+
+echo elgg_view_module('inline', elgg_echo('tidypics:server_info'), $content); \ No newline at end of file
diff --git a/mod/lightpics/views/default/admin/settings/photos/settings.php b/mod/lightpics/views/default/admin/settings/photos/settings.php
new file mode 100644
index 000000000..6ea444392
--- /dev/null
+++ b/mod/lightpics/views/default/admin/settings/photos/settings.php
@@ -0,0 +1,18 @@
+<?php
+/**
+ * Tidypics settings
+ */
+
+if (tidypics_is_upgrade_available()) {
+ echo '<div class="elgg-admin-notices">';
+ echo '<p>';
+ echo elgg_view('output/url', array(
+ 'text' => elgg_echo('tidypics:upgrade'),
+ 'href' => 'action/photos/admin/upgrade',
+ 'is_action' => true,
+ ));
+ echo '</p>';
+ echo '</div>';
+}
+
+echo elgg_view_form('photos/admin/settings');
diff --git a/mod/lightpics/views/default/admin/settings/photos/thumbnail.php b/mod/lightpics/views/default/admin/settings/photos/thumbnail.php
new file mode 100644
index 000000000..5f9769e91
--- /dev/null
+++ b/mod/lightpics/views/default/admin/settings/photos/thumbnail.php
@@ -0,0 +1,54 @@
+<?php
+/**
+ * Tidypics thumbnail creation tool
+ */
+
+$title = elgg_echo('tidypics:settings:thumbnail');
+$body = '<p>' . elgg_echo('tidypics:thumbnail_tool_blurb') . '</p>';
+$im_id = elgg_echo('tidypics:settings:im_id');
+$input = elgg_view('input/text', array(
+ 'name' => 'image_id'
+));
+$submit = elgg_view('input/submit', array(
+ 'value' => elgg_echo('submit'),
+ 'id' => 'elgg-tidypics-im-test'
+));
+
+$body .=<<<HTML
+ <p>
+ <label>$im_id $input</label>
+ </p>
+ <p>
+ $submit
+ <div id="elgg-tidypics-im-results"></div>
+ </p>
+HTML;
+
+echo elgg_view_module('inline', $title, $body);
+
+?>
+
+<script type="text/javascript">
+ $(function() {
+ $('#elgg-tidypics-im-test').click(function() {
+ var image_id = $('input[name=image_id]').val();
+ $("#elgg-tidypics-im-results").html('<div class="elgg-ajax-loader"></div>');
+ elgg.action('photos/admin/create_thumbnails', {
+ format: 'JSON',
+ data: {guid: image_id},
+ cache: false,
+ success: function(result) {
+ // error
+ if (result.status < 0) {
+ var html = '';
+ } else {
+ var html = '<img class="elgg-photo tidypics-photo" src="'
+ + result.output.thumbnail_src + '" alt="' + result.output.title
+ + '" />';
+ }
+ $("#elgg-tidypics-im-results").html(html);
+ }
+ });
+ });
+ });
+</script> \ No newline at end of file