Re: Panorama module for G3
Mike Miller <[email protected]> Sun, 6 Jan 2013 11:13:38 +0200
| Newsgroups | gmane.comp.web.gallery.devel |
|---|---|
| Message-ID | <CAGYq59ey2fy9_qFz=DNJbHedo88tmoMyzBsyh3u0HgQR0SEW5g@mail.gmail.com> |
On Thu, Jul 16, 2009 at 6:43 AM, Bharat Mediratta <[email protected]> wrote: > Sorry to take so long to respond to this. I've been busy travelling and > getting beta 2 out the door. It took three and a half years for me to respond... but I actually did this, finally! A bit of a long email follows; there's a question at the very end. The last time I looked at the G3 code, I was a bit scared (which is why I never even responded to your email, though looking back, it was actually quite detailed and contained everything I needed to know. Having spent a bit of time in the past few years working with an MVC framework at work, I felt that my skills, which once upon a time were basically only systems programming in C (and assembly) were ready for this all this newfangled stuff. It turns out that G3 was quite pleasant to develop for; definitely more so than G2 in terms of simplicity, and light years ahead of the crud I usually hack out in wordpress plugins. A few notes, interspersed with your email (and mine, since I doubt anyone's memory goes this far back) >> 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: By now, of course, there is; $form->edit_form etc. I used the editcreation and editcaptured modules for a template. [... snip ...] > 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. Right now, I added a models/MY_Item_Model.php, and hooked into resize_img . I didn't want to create my own theme (I started doing that, but I found the "mini mode" of greydragon to be much better for my integration into my existing site style), but this seems to have worked ok. There's a forum topic at http://gallery.menalto.com/node/110643; the code itself is at https://github.com/mikeage/panorama . Any feedback would be greatly appreciated. Two open issues: 1. the only bug I'm aware of is that I display the full size image, which assumes the user (who thinks he's viewing a resized image) needs permission to see the full image. I haven't yet added a check for what happens when the user doesn't have full permissions. 2. From my experiments in G2, I saw that there's a maximum size that I can display without running out of memory. In G2, I set multiple resizes. I don't see a way to do that in G3; any suggestions for how I can store 4 images: full size, normal resize, resize for the panorama viewer (probably much bigger than the normal resize), and thumbnail? Thanks in advance -- Mike ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnmore_123012 __[ g a l l e r y - d e v e l ]_________________________ [ list info/archive --> http://gallery.sf.net/lists.php ] [ gallery info/FAQ/download --> http://gallery.sf.net ]