Closed (fixed)
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
9 Nov 2012 at 15:05 UTC
Updated:
2 Feb 2013 at 04:10 UTC
For displaying very large images, a map-style interface is useful. This module provides a formatter to display images in the OpenLayers mapping interface, and a drush command for batch preprocessing the images into tiles at the necessary different zoom levels.
Dependencies:
http://drupal.org/project/openlayers
http://drupal.org/project/media
Project page: http://drupal.org/sandbox/noahadler/1787024
Git clone command:
git clone --recursive --branch 7.x-1.x http://git.drupal.org/sandbox/noahadler/1787024.git media_imagezoom
This is for Drupal 7.
Comments
Comment #1
killua99 commentedAll the code is really good. Don't see any problem here.
Comment #2
bripatand commentedYou should remove your name from the above git command and use:
git clone http://git.drupal.org/sandbox/noahadler/1787024.git media_imagezoom
Anyway, when running the command, I got the error message:
warning: remote HEAD refers to nonexistent ref, unable to checkout.
Comment #3
noahadler commented@bripatand, thanks, not sure how I missed that! I've updated the original post. There is no master branch though, so it does need to retain the --branch 7.x-1.x, otherwise you'd have to git checkout 7.x-1.x after you clone. I think that's the cause of that error.
Comment #4
roynilanjan commentedHave a look few code observations,
In _media_imagezoom_tile function,
in the else part & if you want to return some debuging information of an object then should have some option(do you want debug the problem? if yes then enable the devel module & use it's debug functions (dpm,dvm etc..) instead of direct print_r other wise if user get an error & long object format will be confused
Comment #5
vineet.osscube commentedStatus - Needs Work
Manual Review :
When you are emitting information which is important for the logs, use drush_log() instead of drush_print(). This is helpful because command can be executed remotely and drush_log() insures that your log info gets passed back to the caller correctly.
For example, the 'package downloaded' log info should be:
OLD:
drush_print("{$this->project->name}downloaded from{$this->project->download['url']}.");NEW:
drush_log("{$this->project->name}downloaded from{$this->project->download['url']}.", 'ok');Comment #6
noahadler commentedThanks for the feedback! I've updated the code to try to meet most of the issues encountered above, including some comments where necessary.
@roynilanjan, afaict, watchdog() is a function defined in the bootstrap.inc part of core, so is always available to call, even if you disable the dblog module.
I've replaced the hard-coded tile paths with a variable_get for the path to the tiles, and I'll work on creating an admin interface to make it easy to change this. I didn't include the 1.0.0 portion, because it's a convention for these TMS-style tiles that the OpenLayers viewer automatically checks for.
I'll get that admin interface going asap!
Comment #7
roynilanjan commentedOne question if we use hook_watchdog instead of direct watchdog function - then it can be treated as logger according to severity!
- what do you think?
if you want to return some debuging information of an object then should have some option(do you want debug the problem? if yes then enable the devel module & use it's debug functions (dpm,dvm etc..) instead of direct print_r other wise if user get an error & long object format will be confused
=> what about this?
Comment #8
noahadler commentedHi roynilanjan,
I'm not sure what you mean about hook_watchdog. I think the watchdog function calls all the modules that implement hook_watchdog, such as dblog, or log4php. So it's already taken care of!
I did remove the print_r functions and replace them with dpm in the latest commits, and check that function_exists('dpm') too.
Still got to knock out the admin interface, then I'll set back to 'needs review'! Thanks for the help everyone.
Comment #9
roynilanjan commentedHave some questions,
- If DB log module disable then where watchdog will log the information?
using hook_watchdog i can send email to site administrator (Error log information)even my dblog module disabled!
Please have a look http://api.drupal.org/api/drupal/modules%21system%21system.api.php/funct...
http://www.calebthorne.com/blog/2012/Jun/understanding-drupal-hookmail
Comment #10
noahadler commentedUpdate: I've added an admin interface that lets you set the 'base URI' for tile storage. This way you can change it from 'public://tiles' to private storage or different location.
@roynilanjan, I maintain that this module should not implement hook_watchdog, nor call it directly. This module simply calls watchdog to log diagnostic information about this module's functionality, which is deep image zooming, not system logging. The watchdog function, in turn, calls any module functions which implement hook_watchdog. This is standard behavior for Drupal hook system, which is well documented, and a rough equivalent of the Observer pattern. So in short, if you disable all your modules which do implement hook_watchdog, you will by design not get any logging from any systems through watchdog. Hope this make sense!
Comment #11
roynilanjan commentedSorry but conceptually wrong idea you have regarding,
watchdog calls internally hook_watchdog by using module_invoke but this is not a observation pattern this normal drupal hook behavior module_invoke or module_invokeall(this is implemented by PHP basic callback mechanism call_user_function-array)
dependency which we provide normally through info file actually this is a good example of observer pattern
One more thing I can't understand=>This module simply calls watchdog to log diagnostic information about this module's functionality, which is deep image zooming... what is difference between this and system loging? can you please explain..
Although i'll go thorough your module shortly & let you know if anything in my view
Comment #12
scotthorn commentedThe code looks great to me. Especially your inclusion of drush commands for admins to pre-cut all the tiles if necessary. Nice.
@roynilanjan, I don't believe modules that use the watchdog function have to implement hook_watchdog. Just in core, there are ~16 modules that use the function, but only four that implement the hook:
http://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/calls...
http://api.drupal.org/api/drupal/modules%21system%21system.api.php/funct...
I think if you used a watchdog call at line 137 it would be sufficient. The only other small thing I noticed was what looks like a leftover print function from development on line 216. IMO after those it's ready to go!
Comment #13
noahadler commentedThanks for the review, @scotthorn! I've removed that print command-- it was, as you say, a leftover from development at some point.
Comment #14
klausiWe are currently quite busy with all the project applications and I can only review projects with a review bonus. Please help me reviewing and I'll take a look at your project right away :-)
Comment #15
jthorson commentedOne other comment ...
; Information added by drupal.org packaging script on 2011-10-12core = "7.x"Otherwise, looks good!
Thanks for your contribution, PERSONNAME!
I updated your account to let you promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and get involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.
Comment #16.0
(not verified) commentedChange URL to remove username