From 6064884c3132e55d69f6def45e618655101ad1c3 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Tue, 7 Feb 2012 16:19:51 -0800 Subject: Refs #16. Added stats page. --- languages/en.php | 11 +++++- start.php | 3 +- views/default/admin/statistics/tidypics.php | 57 +++++++++++++++++++++++++++++ views/default/tidypics/admin/stats.php | 36 ------------------ 4 files changed, 69 insertions(+), 38 deletions(-) create mode 100644 views/default/admin/statistics/tidypics.php delete mode 100644 views/default/tidypics/admin/stats.php diff --git a/languages/en.php b/languages/en.php index 6f3de51ef..54cf2f258 100644 --- a/languages/en.php +++ b/languages/en.php @@ -12,6 +12,7 @@ $english = array( 'album' => "Photo Album", 'albums' => "Photo Albums", 'admin:settings:tidypics' => 'Tidypics', + 'admin:statistics:tidypics' => 'Tidypics', 'photos:add' => "Create album", 'images:upload' => "Upload photos", @@ -49,7 +50,7 @@ $english = array( 'tidypics:viewsbyowner' => "by %s users (not including you)", 'tidypics:viewsbyothers' => "(%s by you)", 'tidypics:administration' => 'Tidypics Administration', - 'tidypics:stats' => 'Stats', + 'tidypics:stats' => 'Tidypics Stats', 'tidypics:nophotosingroup' => 'This groups does not have any photos yet', 'tidypics:upgrade' => 'Upgrade', 'tidypics:sort' => 'Sorting the %s album', @@ -89,6 +90,14 @@ $english = array( 'tidypics:option:none' => 'None', 'tidypics:option:cover' => 'Cover', 'tidypics:option:set' => 'Set', + + // stats + 'tidypics:stats:images' => 'Total images', + 'tidypics:stats:albums' => 'Total albums', + 'tidypics:stats:photo_comments' => 'Total comments on photos', + 'tidypics:stats:album_comments' => 'Total comments on albums', + 'tidypics:stats:views' => 'Total views', + 'tidypics:stats:tags' => 'Total tags', //actions 'album:create' => "Create new album", diff --git a/start.php b/start.php index f1fdf8434..5ea04f160 100644 --- a/start.php +++ b/start.php @@ -48,8 +48,9 @@ function tidypics_init() { // Add photos link to owner block/hover menus elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'tidypics_owner_block_menu'); - // Add admin menu item + // Add admin menu items elgg_register_admin_menu_item('configure', 'tidypics', 'settings'); + elgg_register_admin_menu_item('administer', 'tidypics', 'statistics'); // Register for search elgg_register_entity_type('object', 'image'); diff --git a/views/default/admin/statistics/tidypics.php b/views/default/admin/statistics/tidypics.php new file mode 100644 index 000000000..3e4af782a --- /dev/null +++ b/views/default/admin/statistics/tidypics.php @@ -0,0 +1,57 @@ +dbprefix}entities where subtype={$img_type}"; +$total = get_data_row($query); +$num_images = $total->total; +$stats['images'] = $total->total; + +$img_type = get_subtype_id('object', 'album'); +$query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}"; +$total = get_data_row($query); +$num_albums = $total->total; +$stats['albums'] = $total->total; + +$options = array( + 'count' => true, + 'type' => 'object', + 'subtype' => 'image', + 'annotation_name' => 'generic_comment' +); + +$stats['photo_comments'] = elgg_get_annotations($options); + +$options['subtype'] = 'album'; +$stats['album_comments'] = elgg_get_annotations($options); + +$options['subtype'] = 'image'; +$options['annotation_name'] = 'tp_view'; +$stats['views'] = elgg_get_annotations($options); + +if (elgg_get_plugin_setting('tagging', 'tidypics') != 'disabled') { + $options['annotation_name'] = 'phototag'; + $stats['tags'] = elgg_get_annotations($options); +} + +$content = ''; + +foreach ($stats as $str => $value) { + $str = elgg_echo("tidypics:stats:$str"); + $value = (int)$value; + + $content .= << + + + +HTML; +} + +$content .= '
$str:$value
'; + +echo elgg_view_module('inline', elgg_echo('tidypics:stats'), $content); \ No newline at end of file diff --git a/views/default/tidypics/admin/stats.php b/views/default/tidypics/admin/stats.php deleted file mode 100644 index 0b088dc2e..000000000 --- a/views/default/tidypics/admin/stats.php +++ /dev/null @@ -1,36 +0,0 @@ -dbprefix}entities where subtype={$img_type}"; -$total = get_data_row($query); -$num_images = $total->total; - -$img_type = get_subtype_id('object', 'album'); -$query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}"; -$total = get_data_row($query); -$num_albums = $total->total; - -$num_comments_photos = count_annotations(0, 'object', 'image', 'generic_comment'); -$num_comments_albums = count_annotations(0, 'object', 'album', 'generic_comment'); - -$num_views = count_annotations(0, 'object', 'image', 'tp_view'); - -if (get_plugin_setting('tagging', 'tidypics') != "disabled") { - $num_tags = count_annotations(0, 'object', 'image', 'phototag'); -} -?> -

-
- Photos:
- Albums:
- Comments on photos:
- Comments on albums:
- Total views:
- - Photo tags:
- -

\ No newline at end of file -- cgit v1.2.3 From 1c0b514cd009d66544aba2902abc2000f5cb5f43 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Tue, 7 Feb 2012 18:24:42 -0800 Subject: Refs #16. Added server info page. --- languages/en.php | 27 +++- pages/admin.php | 1 + pages/server_analysis.php | 143 --------------------- start.php | 1 + .../administer_utilities/tidypics_server_info.php | 130 +++++++++++++++++++ views/default/admin/statistics/tidypics.php | 6 + views/default/tidypics/admin/settings.php | 2 + views/default/tidypics/admin/tidypics.php | 3 + 8 files changed, 169 insertions(+), 144 deletions(-) delete mode 100644 pages/server_analysis.php create mode 100644 views/default/admin/administer_utilities/tidypics_server_info.php diff --git a/languages/en.php b/languages/en.php index 54cf2f258..4e56c0074 100644 --- a/languages/en.php +++ b/languages/en.php @@ -11,8 +11,11 @@ $english = array( 'photos' => "Photos", 'album' => "Photo Album", 'albums' => "Photo Albums", + 'tidypics:disabled' => 'Disabled', + 'tidypics:enabled' => 'Enabled', 'admin:settings:tidypics' => 'Tidypics', 'admin:statistics:tidypics' => 'Tidypics', + 'admin:administer_utilities:tidypics_server_info' => 'Tidypics Server Analysis', 'photos:add' => "Create album", 'images:upload' => "Upload photos", @@ -98,7 +101,29 @@ $english = array( 'tidypics:stats:album_comments' => 'Total comments on albums', 'tidypics:stats:views' => 'Total views', 'tidypics:stats:tags' => 'Total tags', - + + // server analysis + 'tidypics:server_info:gd_desc' => 'Elgg requires the GD extension to be loaded', + 'tidypics:server_info:exec_desc' => 'Required for ImageMagick command line', + 'tidypics:server_info:memory_limit_desc' => 'Change memory_limit to increase', + 'tidypics:server_info:peak_usage_desc' => 'This is approximately the minimum per page', + 'tidypics:server_info:upload_max_filesize_desc' => 'Max size of an uploaded image', + 'tidypics:server_info:post_max_size_desc' => 'Max post size = sum of images + html form', + 'tidypics:server_info:max_input_time_desc' => 'Time script waits for upload to finish', + 'tidypics:server_info:max_execution_time_desc' => 'Max time a script will run', + 'tidypics:server_info:use_only_cookies_desc' => 'Cookie only sessions may affect the Flash uploader', + + 'tidypics:server_info:php_version' => 'PHP Version', + 'tidypics:server_info:memory_limit' => 'Memory Available to PHP', + 'tidypics:server_info:peak_usage' => 'Memory Used to Load This Page', + 'tidypics:server_info:upload_max_filesize' => 'Max File Upload Size', + 'tidypics:server_info:post_max_size' => 'Max Post Size', + 'tidypics:server_info:max_input_time' => 'Max Input Time', + 'tidypics:server_info:max_execution_time' => 'Max Execution Time', + 'tidypics:server_info:use_only_cookies' => 'Cookie only sessions', + + 'tidypics:server_configuration_doc' => 'Server configuration documentation', + //actions 'album:create' => "Create new album", 'album:add' => "Add Photo Album", diff --git a/pages/admin.php b/pages/admin.php index 1a04ab279..c6be1212a 100644 --- a/pages/admin.php +++ b/pages/admin.php @@ -1,6 +1,7 @@ -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PHP version
GDElgg requires the GD extension to be loaded
IMagick PHP extension
exec()Required for ImageMagick command line
Memory Available to PHPChange memory_limit to increase
Memory Used to Load This PageThis is approximately the minimum per page
Max File Upload SizeMax size of an uploaded image
Max Post SizeMax post size = sum of images + html form
Max Input Time sTime script waits for upload to finish
Max Execution Time sMax time a script will run
GD imagejpeg
GD imagepng
GD imagegif
EXIF
Cookie only sessionsCookie only sessions may affect the Flash uploader
-
- ">Server configuration doc -
-
- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
GD
IMagick
exec()
s
s
GD imagejpeg
GD imagepng
GD imagegif
EXIF
+ +

+ '/mod/tidypics/docs/configure_server.txt', + 'text' => elgg_echo('tidypics:server_configuration_doc') + )); + ?> +

+dbprefix}entities where subtype={$img_type}"; $total = get_data_row($query); $num_images = $total->total; $stats['images'] = $total->total; +// number of albums $img_type = get_subtype_id('object', 'album'); $query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}"; $total = get_data_row($query); @@ -24,15 +26,19 @@ $options = array( 'annotation_name' => 'generic_comment' ); +// number of comments on photos $stats['photo_comments'] = elgg_get_annotations($options); +// number of comments on albums $options['subtype'] = 'album'; $stats['album_comments'] = elgg_get_annotations($options); +// number of views on images $options['subtype'] = 'image'; $options['annotation_name'] = 'tp_view'; $stats['views'] = elgg_get_annotations($options); +// number of photo tags on images if (elgg_get_plugin_setting('tagging', 'tidypics') != 'disabled') { $options['annotation_name'] = 'phototag'; $stats['tags'] = elgg_get_annotations($options); diff --git a/views/default/tidypics/admin/settings.php b/views/default/tidypics/admin/settings.php index e1d20f953..aff6acc8d 100644 --- a/views/default/tidypics/admin/settings.php +++ b/views/default/tidypics/admin/settings.php @@ -1,6 +1,8 @@ Date: Tue, 7 Feb 2012 19:04:35 -0800 Subject: Refs #16. Added image lib tester to utilities. --- actions/admin/imtest.php | 2 +- languages/en.php | 18 ++- start.php | 2 +- .../administer_utilities/tidypics_server_info.php | 130 ---------------- .../admin/administer_utilities/tidypics_tools.php | 166 +++++++++++++++++++++ views/default/tidypics/admin/imagelib.php | 62 -------- 6 files changed, 185 insertions(+), 195 deletions(-) delete mode 100644 views/default/admin/administer_utilities/tidypics_server_info.php create mode 100644 views/default/admin/administer_utilities/tidypics_tools.php delete mode 100644 views/default/tidypics/admin/imagelib.php diff --git a/actions/admin/imtest.php b/actions/admin/imtest.php index 293a9b2e8..a58643d0e 100644 --- a/actions/admin/imtest.php +++ b/actions/admin/imtest.php @@ -2,7 +2,7 @@ /** * Tidypics ImageMagick Location Test * - * Called through ajax + * Called through ajax. Not a registered Elgg action. */ $location = $_GET['location']; diff --git a/languages/en.php b/languages/en.php index 4e56c0074..cb3b370f9 100644 --- a/languages/en.php +++ b/languages/en.php @@ -15,7 +15,7 @@ $english = array( 'tidypics:enabled' => 'Enabled', 'admin:settings:tidypics' => 'Tidypics', 'admin:statistics:tidypics' => 'Tidypics', - 'admin:administer_utilities:tidypics_server_info' => 'Tidypics Server Analysis', + 'admin:administer_utilities:tidypics_tools' => 'Tidypics Tools', 'photos:add' => "Create album", 'images:upload' => "Upload photos", @@ -103,6 +103,7 @@ $english = array( 'tidypics:stats:tags' => 'Total tags', // server analysis + 'tidypics:server_info' => 'Server information', 'tidypics:server_info:gd_desc' => 'Elgg requires the GD extension to be loaded', 'tidypics:server_info:exec_desc' => 'Required for ImageMagick command line', 'tidypics:server_info:memory_limit_desc' => 'Change memory_limit to increase', @@ -124,6 +125,21 @@ $english = array( 'tidypics:server_configuration_doc' => 'Server configuration documentation', + // library tools + 'tidypics:lib_tools' => 'Image library tools', + 'tidypics:lib_tools:overview' => + 'An image library is required by Tidypics to perform various manipulations: resizing on upload, watermarking, rotation, and cropping. + There are three image library options with Tidypics: PHP extension GD, + ImageMagick called via a system call, and the PHP extension + imagick. GD is the most common of the three on hosted servers but suffers + from serious memory usage problems when resizing photos. If you have access to ImageMagick (whether through system calls or the + PHP extension), we recommend that you use that.', + 'tidypics:lib_tools:testing' => + 'To use the ImageMagick executables, PHP must be configured to allow calls to exec(). You can see the + configuration of your server above. Next, you need to determine the path to ImageMagick on your server. Your hosting service should + be able to provide this to you. You can test if the location is correct below. If successful, it should display the version of + ImageMagick installed on your server.', + //actions 'album:create' => "Create new album", 'album:add' => "Add Photo Album", diff --git a/start.php b/start.php index 918b8aea4..1391184c7 100644 --- a/start.php +++ b/start.php @@ -51,7 +51,7 @@ function tidypics_init() { // Add admin menu items elgg_register_admin_menu_item('configure', 'tidypics', 'settings'); elgg_register_admin_menu_item('administer', 'tidypics', 'statistics'); - elgg_register_admin_menu_item('administer', 'tidypics_server_info', 'administer_utilities'); + elgg_register_admin_menu_item('administer', 'tidypics_tools', 'administer_utilities'); // Register for search elgg_register_entity_type('object', 'image'); diff --git a/views/default/admin/administer_utilities/tidypics_server_info.php b/views/default/admin/administer_utilities/tidypics_server_info.php deleted file mode 100644 index 6a034a561..000000000 --- a/views/default/admin/administer_utilities/tidypics_server_info.php +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GD
IMagick
exec()
s
s
GD imagejpeg
GD imagepng
GD imagegif
EXIF
- -

- '/mod/tidypics/docs/configure_server.txt', - 'text' => elgg_echo('tidypics:server_configuration_doc') - )); - ?> -

- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
GD
IMagick
exec()
s
s
GD imagejpeg
GD imagepng
GD imagegif
EXIF
+ +

+ '/mod/tidypics/docs/configure_server.txt', + 'text' => elgg_echo('tidypics:server_configuration_doc') + )); + ?> +

+' . elgg_echo('tidypics:lib_tools:overview') . '

'; +$content .= '

' . elgg_echo('tidypics:lib_tools:testing') . '

'; +$content .= '

'; +$content .= '

'; + +echo elgg_view_module('inline', elgg_echo('tidypics:lib_tools'), $content); + +?> + diff --git a/views/default/tidypics/admin/imagelib.php b/views/default/tidypics/admin/imagelib.php deleted file mode 100644 index 2b7a3a7b0..000000000 --- a/views/default/tidypics/admin/imagelib.php +++ /dev/null @@ -1,62 +0,0 @@ -dbprefix}entities where subtype={$img_type}"; -$total = get_data_row($query); -$num_images = $total->total; - -$img_type = get_subtype_id('object', 'album'); -$query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}"; -$total = get_data_row($query); -$num_albums = $total->total; - -$num_comments_photos = count_annotations(0, 'object', 'image', 'generic_comment'); -$num_comments_albums = count_annotations(0, 'object', 'album', 'generic_comment'); - -$num_views = count_annotations(0, 'object', 'image', 'tp_view'); - -if (get_plugin_setting('tagging', 'tidypics') != "disabled") - $num_tags = count_annotations(0, 'object', 'image', 'phototag'); -?> -
-

Overview

-

- An image library is required by Tidypics to perform various manipulations: resizing on upload, watermarking, rotation, and cropping. - There are three image library options with Tidypics: PHP extension GD, - ImageMagick called via a system call, and the PHP extension - imagick. GD is the most common of the three on hosted servers but suffers - from serious memory usage problems when resizing photos. If you have access to ImageMagick (whether through system calls or the - PHP extension), we recommend that you use that. -

-

Testing ImageMagick Commandline

-

- To use the ImageMagick executables, PHP must be configured to allow calls to exec(). You can check our - server analysis page to find out the - configuration of your server. Next, you need to determine the path to ImageMagick on your server. Your hosting service should - be able to provide this to you. You can test if the location is correct below. If successful, it should display the version of - ImageMagick installed on your server. -

-
-

-
- - -

-
- - \ No newline at end of file -- cgit v1.2.3 From 65f6184aec8f6c6e5d053d4cb0e0925b9f536570 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Thu, 9 Feb 2012 10:24:59 -0800 Subject: Using tabs for admin pages. --- actions/admin/create_thumbnails.php | 60 -------- actions/admin/imtest.php | 18 --- actions/photos/admin/create_thumbnails.php | 70 +++++++++ actions/photos/admin/imtest.php | 18 +++ languages/en.php | 25 +++- start.php | 5 +- .../admin/administer_utilities/tidypics_tools.php | 166 --------------------- views/default/admin/settings/tidypics.php | 78 ++++++++-- views/default/admin/settings/tidypics/help.php | 57 +++++++ .../default/admin/settings/tidypics/image_lib.php | 38 +++++ .../admin/settings/tidypics/server_info.php | 130 ++++++++++++++++ views/default/admin/settings/tidypics/settings.php | 20 +++ views/default/admin/settings/tidypics/stats.php | 63 ++++++++ .../default/admin/settings/tidypics/thumbnail.php | 52 +++++++ views/default/admin/statistics/tidypics.php | 63 -------- views/default/tidypics/admin/help.php | 32 ---- views/default/tidypics/admin/settings.php | 25 ---- views/default/tidypics/admin/thumbnails.php | 33 ---- views/default/tidypics/admin/tidypics.php | 63 -------- views/default/tidypics/admin/upgrade.php | 35 ----- 20 files changed, 533 insertions(+), 518 deletions(-) delete mode 100644 actions/admin/create_thumbnails.php delete mode 100644 actions/admin/imtest.php create mode 100644 actions/photos/admin/create_thumbnails.php create mode 100644 actions/photos/admin/imtest.php delete mode 100644 views/default/admin/administer_utilities/tidypics_tools.php create mode 100644 views/default/admin/settings/tidypics/help.php create mode 100644 views/default/admin/settings/tidypics/image_lib.php create mode 100644 views/default/admin/settings/tidypics/server_info.php create mode 100644 views/default/admin/settings/tidypics/settings.php create mode 100644 views/default/admin/settings/tidypics/stats.php create mode 100644 views/default/admin/settings/tidypics/thumbnail.php delete mode 100644 views/default/admin/statistics/tidypics.php delete mode 100644 views/default/tidypics/admin/help.php delete mode 100644 views/default/tidypics/admin/settings.php delete mode 100644 views/default/tidypics/admin/thumbnails.php delete mode 100644 views/default/tidypics/admin/tidypics.php delete mode 100644 views/default/tidypics/admin/upgrade.php diff --git a/actions/admin/create_thumbnails.php b/actions/admin/create_thumbnails.php deleted file mode 100644 index a09965f65..000000000 --- a/actions/admin/create_thumbnails.php +++ /dev/null @@ -1,60 +0,0 @@ -getFilename(); -$container_guid = $image->container_guid; -if (!$filename || !$container_guid) { - echo "Error retrieving information about the image"; - return; -} - -$title = $image->title; -$prefix = "image/$container_guid/"; -$filestorename = substr($filename, strlen($prefix)); - -$image_lib = get_plugin_setting('image_lib', 'tidypics'); -if (!$image_lib) { - $image_lib = "GD"; -} - -if ($image_lib == 'ImageMagick') { // ImageMagick command line - - if (tp_create_im_cmdline_thumbnails($image, $prefix, $filestorename) != true) { - trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick command line', E_USER_WARNING); - echo "Failed to create thumbnails"; - } - -} else if ($image_lib == 'ImageMagickPHP') { // imagick PHP extension - - if (tp_create_imagick_thumbnails($image, $prefix, $filestorename) != true) { - trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick PHP', E_USER_WARNING); - echo "Failed to create thumbnails"; - } - -} else { - - if (tp_create_gd_thumbnails($image, $prefix, $filestorename) != true) { - trigger_error('Tidypics warning: failed to create thumbnails - GD', E_USER_WARNING); - echo "Failed to create thumbnails"; - } - -} // end of image library selector - -echo "wwwroot}mod/tidypics/thumbnail.php?file_guid={$guid}&size=large\" alt=\"{$title}\" />"; diff --git a/actions/admin/imtest.php b/actions/admin/imtest.php deleted file mode 100644 index a58643d0e..000000000 --- a/actions/admin/imtest.php +++ /dev/null @@ -1,18 +0,0 @@ -getFilename(); +$container_guid = $image->container_guid; +if (!$filename || !$container_guid) { + register_error(elgg_echo('tidypics:thumbnail_tool:invalid_image_info')); + forward(REFERER); +} + +$title = $image->title; +$prefix = "image/$container_guid/"; +$filestorename = substr($filename, strlen($prefix)); + +$image_lib = elgg_get_plugin_setting('image_lib', 'tidypics'); +if (!$image_lib) { + $image_lib = "GD"; +} + +// ImageMagick command line +if ($image_lib == 'ImageMagick') { + if (!tp_create_im_cmdline_thumbnails($image, $prefix, $filestorename)) { + trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick command line', E_USER_WARNING); + register_error(elgg_echo('tidypics:thumbnail_tool:create_failed')); + forward(REFERER); + } + +// imagick PHP extension +} else if ($image_lib == 'ImageMagickPHP') { + if (!tp_create_imagick_thumbnails($image, $prefix, $filestorename)) { + trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick PHP', E_USER_WARNING); + register_error(elgg_echo('tidypics:thumbnail_tool:create_failed')); + forward(REFERER); + } +// gd +} else { + if (!tp_create_gd_thumbnails($image, $prefix, $filestorename)) { + trigger_error('Tidypics warning: failed to create thumbnails - GD', E_USER_WARNING); + register_error(elgg_echo('tidypics:thumbnail_tool:create_failed')); + forward(REFERER); + } +} + +$url = elgg_normalize_url("photos/thumbnail/$guid/large"); +system_message(elgg_echo('tidypics:thumbnail_tool:created')); + +if (elgg_is_xhr()) { + echo json_encode(array( + 'guid' => $guid, + 'title' => $title, + 'thumbnail_src' => $url + )); +} + +forward(REFERER); \ No newline at end of file diff --git a/actions/photos/admin/imtest.php b/actions/photos/admin/imtest.php new file mode 100644 index 000000000..a58643d0e --- /dev/null +++ b/actions/photos/admin/imtest.php @@ -0,0 +1,18 @@ + "by %s users (not including you)", 'tidypics:viewsbyothers' => "(%s by you)", 'tidypics:administration' => 'Tidypics Administration', - 'tidypics:stats' => 'Tidypics Stats', + 'tidypics:stats' => 'Stats', 'tidypics:nophotosingroup' => 'This groups does not have any photos yet', 'tidypics:upgrade' => 'Upgrade', 'tidypics:sort' => 'Sorting the %s album', @@ -103,7 +103,7 @@ $english = array( 'tidypics:stats:tags' => 'Total tags', // server analysis - 'tidypics:server_info' => 'Server information', + 'tidypics:server_info' => 'Server Information', 'tidypics:server_info:gd_desc' => 'Elgg requires the GD extension to be loaded', 'tidypics:server_info:exec_desc' => 'Required for ImageMagick command line', 'tidypics:server_info:memory_limit_desc' => 'Change memory_limit to increase', @@ -136,9 +136,24 @@ $english = array( PHP extension), we recommend that you use that.', 'tidypics:lib_tools:testing' => 'To use the ImageMagick executables, PHP must be configured to allow calls to exec(). You can see the - configuration of your server above. Next, you need to determine the path to ImageMagick on your server. Your hosting service should - be able to provide this to you. You can test if the location is correct below. If successful, it should display the version of - ImageMagick installed on your server.', + configuration of your server on the "Server Information" tab.. Next, you need to determine the path to + ImageMagick on your server. Your hosting service should be able to provide this to you. You can test + if the location is correct below. If successful, it should display the version of ImageMagick installed + on your server.', + + // thumbnail tool + 'tidypics:thumbnail_tool' => 'Thumbnail Creation', + 'tidypics:thumbnail_tool_blurb' => + 'This page allows you to create thumbnails for images when the thumbnail creation failed during upload. + You may experience problems with thumbnail creation if your image library is not configured properly or + if there is not enough memory for the GD library to load and resize an image. If your users have + experienced problems with thumbnail creation and you have corrected your configuration, you can try to redo the + thumbnails. Find the unique identifier of the photo (it is the number near the end of the url when viewing + a photo) and enter it below.', + 'tidypics:thumbnail_tool:unknown_image' => 'Unable to get original image', + 'tidypics:thumbnail_tool:invalid_image_info' => 'Error retrieving information about the image', + 'tidypics:thumbnail_tool:create_failed' => 'Failed to create thumbnails', + 'tidypics:thumbnail_tool:created' => 'Created thumbnails.', //actions 'album:create' => "Create new album", diff --git a/start.php b/start.php index 1391184c7..ad540bc8f 100644 --- a/start.php +++ b/start.php @@ -48,10 +48,8 @@ function tidypics_init() { // Add photos link to owner block/hover menus elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'tidypics_owner_block_menu'); - // Add admin menu items + // Add admin menu item elgg_register_admin_menu_item('configure', 'tidypics', 'settings'); - elgg_register_admin_menu_item('administer', 'tidypics', 'statistics'); - elgg_register_admin_menu_item('administer', 'tidypics_tools', 'administer_utilities'); // Register for search elgg_register_entity_type('object', 'image'); @@ -107,6 +105,7 @@ function tidypics_init() { //register_action("tidypics/deletetag", false, "$base_dir/deletetag.php"); elgg_register_action("photos/admin/settings", "$base_dir/admin/settings.php", 'admin'); + elgg_register_action("photos/admin/create_thumbnails", "$base_dir/admin/create_thumbnails.php", 'admin'); elgg_register_action("photos/admin/upgrade", "$base_dir/admin/upgrade.php", 'admin'); // Register libraries diff --git a/views/default/admin/administer_utilities/tidypics_tools.php b/views/default/admin/administer_utilities/tidypics_tools.php deleted file mode 100644 index 1df664be8..000000000 --- a/views/default/admin/administer_utilities/tidypics_tools.php +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GD
IMagick
exec()
s
s
GD imagejpeg
GD imagepng
GD imagegif
EXIF
- -

- '/mod/tidypics/docs/configure_server.txt', - 'text' => elgg_echo('tidypics:server_configuration_doc') - )); - ?> -

-' . elgg_echo('tidypics:lib_tools:overview') . '

'; -$content .= '

' . elgg_echo('tidypics:lib_tools:testing') . '

'; -$content .= '

'; -$content .= '

'; - -echo elgg_view_module('inline', elgg_echo('tidypics:lib_tools'), $content); - -?> - diff --git a/views/default/admin/settings/tidypics.php b/views/default/admin/settings/tidypics.php index 2e7d79942..7b1764fed 100644 --- a/views/default/admin/settings/tidypics.php +++ b/views/default/admin/settings/tidypics.php @@ -6,18 +6,66 @@ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 */ -if (tidypics_is_upgrade_available()) { - echo '
'; - echo '

'; - echo elgg_view('output/url', array( - 'text' => elgg_echo('tidypics:upgrade'), - 'href' => 'action/photos/admin/upgrade', - 'is_action' => true, - )); - echo '

'; - echo '
'; -} - -echo elgg_view('output/longtext', array('value' => elgg_echo('tidypics:admin:instructions'))); - -echo elgg_view_form('photos/admin/settings'); +$tab = get_input('tab', 'settings'); + +echo elgg_view('navigation/tabs', array( + 'tabs' => array( + array( + 'text' => elgg_echo('settings'), + 'href' => '/admin/settings/tidypics', + 'selected' => ($tab == 'settings'), + ), + array( + 'text' => elgg_echo('tidypics:server_info'), + 'href' => '/admin/settings/tidypics?tab=server_info', + 'selected' => ($tab == 'server_info'), + ), + array( + 'text' => elgg_echo('tidypics:stats'), + 'href' => '/admin/settings/tidypics?tab=stats', + 'selected' => ($tab == 'stats'), + ), + array( + 'text' => elgg_echo('tidypics:settings:image_lib'), + 'href' => '/admin/settings/tidypics?tab=image_lib', + 'selected' => ($tab == 'image_lib'), + ), + array( + 'text' => elgg_echo('tidypics:settings:thumbnail'), + 'href' => '/admin/settings/tidypics?tab=thumbnail', + 'selected' => ($tab == 'thumbnail'), + ), + array( + 'text' => elgg_echo('tidypics:settings:help'), + 'href' => '/admin/settings/tidypics?tab=help', + 'selected' => ($tab == 'help'), + ), + ) +)); + +switch ($tab) { + case 'server_info': + echo elgg_view('admin/settings/tidypics/server_info'); + break; + + case 'stats': + echo elgg_view('admin/settings/tidypics/stats'); + break; + + case 'image_lib': + echo elgg_view('admin/settings/tidypics/image_lib'); + break; + + case 'thumbnail': + echo elgg_view('admin/settings/tidypics/thumbnail'); + break; + + case 'help': + echo elgg_view('admin/settings/tidypics/help'); + break; + + default: + case 'settings': + echo elgg_view('admin/settings/tidypics/settings'); + break; +} \ No newline at end of file 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 @@ + +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). +

+

+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. +

+HTML; + +echo elgg_view_module('inline', $title, $body); + +$title = 'Question mark images appear'; +$body =<< +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. +

+

+Another possible cause is using ImageMagick when your server does not support it or specifying +the wrong path to the ImageMagick executables. +

+HTML; + +echo elgg_view_module('inline', $title, $body); + + +$title = 'Unable to save settings'; +$body =<<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. +

+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 @@ +' . elgg_echo('tidypics:lib_tools:overview') . '

'; +$content .= '

' . elgg_echo('tidypics:lib_tools:testing') . '

'; +$content .= '

'; +$content .= '

'; + +echo elgg_view_module('inline', elgg_echo('tidypics:lib_tools'), $content); + +?> + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
GD
IMagick
exec()
s
s
GD imagejpeg
GD imagepng
GD imagegif
EXIF
+ +

+ '/mod/tidypics/docs/configure_server.txt', + 'text' => elgg_echo('tidypics:server_configuration_doc') + )); + ?> +

+'; + echo '

'; + echo elgg_view('output/url', array( + 'text' => elgg_echo('tidypics:upgrade'), + 'href' => 'action/photos/admin/upgrade', + 'is_action' => true, + )); + echo '

'; + echo ''; +} + +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/stats.php b/views/default/admin/settings/tidypics/stats.php new file mode 100644 index 000000000..25ace77da --- /dev/null +++ b/views/default/admin/settings/tidypics/stats.php @@ -0,0 +1,63 @@ +dbprefix}entities where subtype={$img_type}"; +$total = get_data_row($query); +$num_images = $total->total; +$stats['images'] = $total->total; + +// number of albums +$img_type = get_subtype_id('object', 'album'); +$query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}"; +$total = get_data_row($query); +$num_albums = $total->total; +$stats['albums'] = $total->total; + +$options = array( + 'count' => true, + 'type' => 'object', + 'subtype' => 'image', + 'annotation_name' => 'generic_comment' +); + +// number of comments on photos +$stats['photo_comments'] = elgg_get_annotations($options); + +// number of comments on albums +$options['subtype'] = 'album'; +$stats['album_comments'] = elgg_get_annotations($options); + +// number of views on images +$options['subtype'] = 'image'; +$options['annotation_name'] = 'tp_view'; +$stats['views'] = elgg_get_annotations($options); + +// number of photo tags on images +if (elgg_get_plugin_setting('tagging', 'tidypics') != 'disabled') { + $options['annotation_name'] = 'phototag'; + $stats['tags'] = elgg_get_annotations($options); +} + +$content = ''; + +foreach ($stats as $str => $value) { + $str = elgg_echo("tidypics:stats:$str"); + $value = (int)$value; + + $content .= << + + + +HTML; +} + +$content .= '
$str:$value
'; + +echo elgg_view_module('inline', elgg_echo('tidypics:stats'), $content); \ 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 @@ +' . elgg_echo('tidypics:thumbnail_tool_blurb') . '

'; +$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 .=<< + + $submit +
+

+HTML; + +echo elgg_view_module('inline', $title, $body); + +?> + + \ No newline at end of file diff --git a/views/default/admin/statistics/tidypics.php b/views/default/admin/statistics/tidypics.php deleted file mode 100644 index 25ace77da..000000000 --- a/views/default/admin/statistics/tidypics.php +++ /dev/null @@ -1,63 +0,0 @@ -dbprefix}entities where subtype={$img_type}"; -$total = get_data_row($query); -$num_images = $total->total; -$stats['images'] = $total->total; - -// number of albums -$img_type = get_subtype_id('object', 'album'); -$query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}"; -$total = get_data_row($query); -$num_albums = $total->total; -$stats['albums'] = $total->total; - -$options = array( - 'count' => true, - 'type' => 'object', - 'subtype' => 'image', - 'annotation_name' => 'generic_comment' -); - -// number of comments on photos -$stats['photo_comments'] = elgg_get_annotations($options); - -// number of comments on albums -$options['subtype'] = 'album'; -$stats['album_comments'] = elgg_get_annotations($options); - -// number of views on images -$options['subtype'] = 'image'; -$options['annotation_name'] = 'tp_view'; -$stats['views'] = elgg_get_annotations($options); - -// number of photo tags on images -if (elgg_get_plugin_setting('tagging', 'tidypics') != 'disabled') { - $options['annotation_name'] = 'phototag'; - $stats['tags'] = elgg_get_annotations($options); -} - -$content = ''; - -foreach ($stats as $str => $value) { - $str = elgg_echo("tidypics:stats:$str"); - $value = (int)$value; - - $content .= << - - - -HTML; -} - -$content .= '
$str:$value
'; - -echo elgg_view_module('inline', elgg_echo('tidypics:stats'), $content); \ No newline at end of file diff --git a/views/default/tidypics/admin/help.php b/views/default/tidypics/admin/help.php deleted file mode 100644 index b939a74a8..000000000 --- a/views/default/tidypics/admin/help.php +++ /dev/null @@ -1,32 +0,0 @@ -
-

White screen when uploading images

-

-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). -

-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. -

-

Question mark images appear

-

-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. -

-Another possible cause is using ImageMagick when your server does not support it or specifying -the wrong path to the ImageMagick executables. -

-

Unable to save settings

-

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. -

\ No newline at end of file diff --git a/views/default/tidypics/admin/settings.php b/views/default/tidypics/admin/settings.php deleted file mode 100644 index aff6acc8d..000000000 --- a/views/default/tidypics/admin/settings.php +++ /dev/null @@ -1,25 +0,0 @@ - "{$vars['url']}mod/tidypics/pages/server_analysis.php", - 'text' => elgg_echo('tidypics:settings:server:analysis'), -)); - -echo elgg_view('output/longtext', array('value' => elgg_echo('tidypics:admin:instructions'))); - -echo '

'; -echo elgg_view('tidypics/admin/upgrade'); -echo $server_analysis_link; -echo '

'; - -echo elgg_view('input/form', array( - 'body' => $form_body, - 'action' => $vars['url'] . 'action/tidypics/admin/settings', -)); diff --git a/views/default/tidypics/admin/thumbnails.php b/views/default/tidypics/admin/thumbnails.php deleted file mode 100644 index 5884b9dc3..000000000 --- a/views/default/tidypics/admin/thumbnails.php +++ /dev/null @@ -1,33 +0,0 @@ -
-

Overview

-

-This page allows you to create thumbnails for images when the thumbnail creation failed during upload. -You may experience problems with thumbnail creation if your image library is not configured properly or -if there is not enough memory for the GD library to load and resize an image. If your users have -experienced problems with thumbnail creation and you have corrected your configuration, you can try to redo the -thumbnails. Find the unique identifier of the photo (it is the number near the end of the url when viewing -a photo) and enter it below. -

-

Thumbnail Creation

-

-: - - -

-
- \ No newline at end of file diff --git a/views/default/tidypics/admin/tidypics.php b/views/default/tidypics/admin/tidypics.php deleted file mode 100644 index 479eb86e2..000000000 --- a/views/default/tidypics/admin/tidypics.php +++ /dev/null @@ -1,63 +0,0 @@ - -
-
-
    -
  • >
  • -
  • >
  • -
  • >
  • -
  • >
  • -
  • >
  • -
-
- -
diff --git a/views/default/tidypics/admin/upgrade.php b/views/default/tidypics/admin/upgrade.php deleted file mode 100644 index bb0a12467..000000000 --- a/views/default/tidypics/admin/upgrade.php +++ /dev/null @@ -1,35 +0,0 @@ -pluginspath}tidypics/version.php"; - -$upgrade_url = "{$vars['url']}action/tidypics/admin/upgrade"; - -// determine whether an upgrade is required -$local_version = get_plugin_setting('version', 'tidypics'); -if ($local_version === FALSE) { - // no version set so either new install or really old one - if (!get_subtype_class('object', 'image') || !get_subtype_class('object', 'album')) { - $local_version = 0; - } else { - // set initial version for new install - set_plugin_setting('version', $version, 'tidypics'); - $local_version = $version; - } -} elseif ($local_version == '1.62') { - // special work around to handle old upgrade system - $local_version = 2010010101; - set_plugin_setting('version', $local_version, 'tidypics'); -} -if ($local_version == $version) { - // no upgrade required - return TRUE; -} - -echo elgg_view('output/url', array( - 'text' => elgg_echo('tidypics:upgrade'), - 'href' => $upgrade_url, - 'is_action' => TRUE) -); - -echo '
'; -- cgit v1.2.3 From 67d855d73499f36f15331e1ff18cccd13aa8aa74 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Thu, 9 Feb 2012 10:25:57 -0800 Subject: Fixes #16. Removed stats. --- languages/en.php | 8 ---- views/default/admin/settings/tidypics.php | 9 ---- views/default/admin/settings/tidypics/stats.php | 63 ------------------------- 3 files changed, 80 deletions(-) delete mode 100644 views/default/admin/settings/tidypics/stats.php diff --git a/languages/en.php b/languages/en.php index dd6d91e96..dc109dd05 100644 --- a/languages/en.php +++ b/languages/en.php @@ -94,14 +94,6 @@ $english = array( 'tidypics:option:cover' => 'Cover', 'tidypics:option:set' => 'Set', - // stats - 'tidypics:stats:images' => 'Total images', - 'tidypics:stats:albums' => 'Total albums', - 'tidypics:stats:photo_comments' => 'Total comments on photos', - 'tidypics:stats:album_comments' => 'Total comments on albums', - 'tidypics:stats:views' => 'Total views', - 'tidypics:stats:tags' => 'Total tags', - // server analysis 'tidypics:server_info' => 'Server Information', 'tidypics:server_info:gd_desc' => 'Elgg requires the GD extension to be loaded', diff --git a/views/default/admin/settings/tidypics.php b/views/default/admin/settings/tidypics.php index 7b1764fed..cc9875c3b 100644 --- a/views/default/admin/settings/tidypics.php +++ b/views/default/admin/settings/tidypics.php @@ -20,11 +20,6 @@ echo elgg_view('navigation/tabs', array( 'href' => '/admin/settings/tidypics?tab=server_info', 'selected' => ($tab == 'server_info'), ), - array( - 'text' => elgg_echo('tidypics:stats'), - 'href' => '/admin/settings/tidypics?tab=stats', - 'selected' => ($tab == 'stats'), - ), array( 'text' => elgg_echo('tidypics:settings:image_lib'), 'href' => '/admin/settings/tidypics?tab=image_lib', @@ -48,10 +43,6 @@ switch ($tab) { echo elgg_view('admin/settings/tidypics/server_info'); break; - case 'stats': - echo elgg_view('admin/settings/tidypics/stats'); - break; - case 'image_lib': echo elgg_view('admin/settings/tidypics/image_lib'); break; diff --git a/views/default/admin/settings/tidypics/stats.php b/views/default/admin/settings/tidypics/stats.php deleted file mode 100644 index 25ace77da..000000000 --- a/views/default/admin/settings/tidypics/stats.php +++ /dev/null @@ -1,63 +0,0 @@ -dbprefix}entities where subtype={$img_type}"; -$total = get_data_row($query); -$num_images = $total->total; -$stats['images'] = $total->total; - -// number of albums -$img_type = get_subtype_id('object', 'album'); -$query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}"; -$total = get_data_row($query); -$num_albums = $total->total; -$stats['albums'] = $total->total; - -$options = array( - 'count' => true, - 'type' => 'object', - 'subtype' => 'image', - 'annotation_name' => 'generic_comment' -); - -// number of comments on photos -$stats['photo_comments'] = elgg_get_annotations($options); - -// number of comments on albums -$options['subtype'] = 'album'; -$stats['album_comments'] = elgg_get_annotations($options); - -// number of views on images -$options['subtype'] = 'image'; -$options['annotation_name'] = 'tp_view'; -$stats['views'] = elgg_get_annotations($options); - -// number of photo tags on images -if (elgg_get_plugin_setting('tagging', 'tidypics') != 'disabled') { - $options['annotation_name'] = 'phototag'; - $stats['tags'] = elgg_get_annotations($options); -} - -$content = ''; - -foreach ($stats as $str => $value) { - $str = elgg_echo("tidypics:stats:$str"); - $value = (int)$value; - - $content .= << - - - -HTML; -} - -$content .= '
$str:$value
'; - -echo elgg_view_module('inline', elgg_echo('tidypics:stats'), $content); \ No newline at end of file -- cgit v1.2.3