Re: Panorama module for G3

Bharat Mediratta <[email protected]> Mon, 14 Jan 2013 11:27:48 -0800
Newsgroups gmane.comp.web.gallery.devel
Message-ID <CAESa+_k5ZT8UH=Kak31ybJbuYaUi2J6GieGg_dvFnBnJtgfuLg@mail.gmail.com>
Welcome back, Mike :-)

I suspect that there are several better ways to do this, but it sounds like
what you have now works so we should start by getting it into the
gallery3-contrib repo.  Can you fork gallery3-contrib on github and move
your module into the 3.0/modules directory and submit a pull request?
 That'll get it into a central location where we can hack on it together.
 I'm going to suggest some stuff below, but don't worry about doing those
things yet - just start by getting into share source control first.

Next up, I like the resize_img hack, but it's a hack because we want to
avoid having to override Item_Model.  You can only ever do one override so
your module will eventually clash with other ones.  I think a better model
is to do what we do with Item_Model::movie_img where we load up all the
data to build the tag and then call out to the movie_img event and let any
modules return a custom view.  In your case you'd modify
Item_Model::resize_img to mimic the same event driven model and submit a
pull request to the gallery3 repo, then in your module you'd create an
event handler which receives the resize_img event and returns your your
<object> tag in your own custom view.

Gallery3 only supports a single resize - multiple resizes were too
confusing and didn't provide a lot of benefit.  Do you really need to have
multiple resizes for this to work smoothly?

Also, do you have a demo up somewhere?

-Bharat




On Sun, Jan 6, 2013 at 1:13 AM, Mike Miller <[email protected]> wrote:

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

------------------------------------------------------------------------------
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. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412

__[ 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 ]