diff options
Diffstat (limited to 'views/default/admin/settings/tidypics')
-rw-r--r-- | views/default/admin/settings/tidypics/help.php | 57 | ||||
-rw-r--r-- | views/default/admin/settings/tidypics/image_lib.php | 38 | ||||
-rw-r--r-- | views/default/admin/settings/tidypics/server_info.php | 130 | ||||
-rw-r--r-- | views/default/admin/settings/tidypics/settings.php | 20 | ||||
-rw-r--r-- | views/default/admin/settings/tidypics/thumbnail.php | 52 |
5 files changed, 297 insertions, 0 deletions
diff --git a/views/default/admin/settings/tidypics/help.php b/views/default/admin/settings/tidypics/help.php new file mode 100644 index 000000000..bf08de284 --- /dev/null +++ b/views/default/admin/settings/tidypics/help.php @@ -0,0 +1,57 @@ +<?php +/** + * Tidypics Help + * + * @todo This would be hard to localize cleanly. + */ + +$title = 'White screen when uploading images'; + +$body = <<<HTML +<p> +Tidypics tries to calculate the maximum size of an image that your server will support. If it +guesses incorrectly and someone uploads a photo that is too large, the script may crash when +resizing the image if you are using GD. The easiest way to test this is to set display_errors +to 1 in your .htaccess file and upload large images. If this causes a problem, a php memory error +should display on the screen. You can increased your php memory limit (see the docs directory). +A better option is to use ImageMagick if your server supports it (again see the docs directory). +</p> +<p> +If it is not a memory issue, you should see some other error appear. Once you have fixed the error, +change display_error back to 0. +</p> +HTML; + +echo elgg_view_module('inline', $title, $body); + +$title = 'Question mark images appear'; +$body =<<<HTML +<p> +If you see question mark images when you look at your albums, this means the resizing of the images +failed. This could be due to the memory limits as described above. There are other causes. Tidypics +tries to detect these problems and write the cause to the error log. You should check your server +error log right after an upload that results in a question mark for these error messages. The messages +will begin with "Tidypics warning:". It is possible if you have turned off php warnings that you will +not see these warnings. +</p> +<p> +Another possible cause is using ImageMagick when your server does not support it or specifying +the wrong path to the ImageMagick executables. +</p> +HTML; + +echo elgg_view_module('inline', $title, $body); + + +$title = 'Unable to save settings'; +$body =<<<HTML +<p>If you are unable to settings, there are two possible causes. First, +Apache can be configured to block pages that use file paths as Tidypics +does when setting the location of the ImageMagick executable. In this case, +leave that field blank. Second, there is some bad code in the Izaps video +plugin that can prevent the settings from being saved. Try disabling that plugin. +</p> +HTML; + +echo elgg_view_module('inline', $title, $body); + diff --git a/views/default/admin/settings/tidypics/image_lib.php b/views/default/admin/settings/tidypics/image_lib.php new file mode 100644 index 000000000..44a7eb847 --- /dev/null +++ b/views/default/admin/settings/tidypics/image_lib.php @@ -0,0 +1,38 @@ +<?php +/** + * Tidypics image library tools + */ + +$content = '<p>' . elgg_echo('tidypics:lib_tools:overview') . '</p>'; +$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 .= 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', elgg_echo('tidypics:lib_tools'), $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/views/default/admin/settings/tidypics/server_info.php b/views/default/admin/settings/tidypics/server_info.php new file mode 100644 index 000000000..96ccc555f --- /dev/null +++ b/views/default/admin/settings/tidypics/server_info.php @@ -0,0 +1,130 @@ +<?php +/** + * Tidypics server analysis + */ + +$title = elgg_echo('admin:administer_utilities:tidypics_tools'); + +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> + +<p class="ptl"> + <?php + echo elgg_view('output/url', array( + 'href' => '/mod/tidypics/docs/configure_server.txt', + 'text' => elgg_echo('tidypics:server_configuration_doc') + )); + ?> +</p> +<?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/views/default/admin/settings/tidypics/settings.php b/views/default/admin/settings/tidypics/settings.php new file mode 100644 index 000000000..3645e749a --- /dev/null +++ b/views/default/admin/settings/tidypics/settings.php @@ -0,0 +1,20 @@ +<?php +/** + * Tidypics main 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('output/longtext', array('value' => elgg_echo('tidypics:admin:instructions'))); + +echo elgg_view_form('photos/admin/settings');
\ No newline at end of file diff --git a/views/default/admin/settings/tidypics/thumbnail.php b/views/default/admin/settings/tidypics/thumbnail.php new file mode 100644 index 000000000..502b5739e --- /dev/null +++ b/views/default/admin/settings/tidypics/thumbnail.php @@ -0,0 +1,52 @@ +<?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> + $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 |