From: Bharat M. <bh...@me...> - 2009-07-16 03:43:32
|
Sorry to take so long to respond to this. I've been busy travelling and getting beta 2 out the door. Mike Miller wrote: > I've been playing around with the beta (actually, the latest git > release as of several hours ago), and am really impressed by the speed > of G3 vs. G2 (even allowing for the fact that I'm proxying to Apache > instead of running directly from NGINX). The import worked really > well, and I'm looking forward to porting my theme to G3 (really just a > wrapper to put my header and left sidebar around the gallery section). > > The one thing I need that isn't in G3 (yet) is a panorama module. I > have a bunch of panoramas which I'm displaying via a customized > version of the panorama module for G3 (it uses a Flash viewer from > http://pan0.net/fspp, which I modified for partial panorama support). > I was thinking of trying to tackle this myself, but I'm looking for > some guidance on where to start (I've never worked with kohana, or any > MVC framework before, although I do have extensive experience in C > programming, as well as a pretty decent grasp of PHP). > > In order to implement a panorama viewer in a similar fashion to that > of G2, I need to do two things. First, the full size image should be > rendered by a different wrapper (instead of img src, it's a parameter > passed to the flash viewer), and not shown via the lightbox effect. > Second, I need to store three pieces of information in the DB for each > picture (whether it's a panorama, and if so, the horizontal FOV and > the vertical FOV). Let's start with the second problem first. To store extra data in the database, you'll need to create your own module. Right now we don't have a way for you to hook into the existing "Edit Photo" dialog. We will eventually, but for now you'll need to do the following: 1) Create your own module (the "developer" module from the gallery3-contrib repo is very helpful for this) 2) Create a database table to store your per-item data (which you'd do in your xxx_installer.php file) 3) Create your own menu button under the "Options" menu. See modules/organize/helpers/organize_menu.php for a simple example of this 4) Create a model class so that you can access your database table using ORM 5) Create your own controller to show your form using Forge 6) Create a controller method that takes the data and stores it in the database using the ORM class. That will get you to the point where you have the data that you need. Now the next problem is, figuring out when you should display a panorama instead of a regular image. There are two ways I can think of, offhand, to do that: 1) Write your own theme, then when it comes time to draw the image, check your database table to see if you have FOV entries and if you do, show the panorama version instead of the regular tag. 2) In your module's xxx_theme.php file, override photo_bottom() and if you detect FOV fields, use JS to rewrite the page to use your imageloader instead of the <img> tag. I'm thinking that approach #2 would work better here. If you're daunted by the 6 step process to create your module, you might talk to rWatcher in the forums and collaborate with him-- he's already written a bunch of community modules. If that doesn't work, let me or Tim know and we can find some time to make a skeleton module for you to hack on. -Bharat |