New Module: photowidget

floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2010-02-14 06:47

I have created a new module inspired from photo widget from www.roytanck.com

Adds 3 configurable blocks to show items in a flash sphere on the sidebar.
* Items in the current album.
* Recently added items.
* Popular items.

I've also set up a Wiki page for it here:
http://codex.gallery2.org/Gallery3:Modules:photowidget

Attached:

 
Slarioux
Slarioux's picture

Joined: 2009-08-08
Posts: 56
Posted: Sun, 2010-02-14 12:41

Cool! Will check it out :)

 
Okat
Okat's picture

Joined: 2009-04-05
Posts: 78
Posted: Sun, 2010-02-14 22:54

Looks awesome! It doesn't respect viewing rights though. Thumbnails of photographs are still viewable. The photo's themselves aren't. Is this by design?

Great work though.

My playground (using customized 3nids theme) http://www.okat.nl

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2010-02-14 23:00

@floridave:
Great work! You're doing web development now?

BTW: I just skimmed over the code. Any reason you don't use UTF-8 as character encoding in the XML you generate? G3 stores everything as UTF-8, so the XML document you generate should be UTF-8 as well.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2010-02-15 01:08

Fixed permissions and XML encoding. re-attached above.
Thanks for the reports.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Okat
Okat's picture

Joined: 2009-04-05
Posts: 78
Posted: Mon, 2010-02-15 08:40

Updated with new download. Don't see any changes regarding permissions. Can still see thumbnails of restricted photographs. Used ctrl+F5 so cache shouldn't be a problem.
Where does one put access/authentication code? In the controller(s), right? If so; can't find anything that looks like a permission check. Was looking for something like: access::required("view", $item);

My playground (using customized 3nids theme) http://www.okat.nl

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2010-02-15 14:28

in controllers/photowidet.php
$photos = ORM::factory("item")
becomes
$photos = ORM::factory("item")->viewable()
Perhaps I don't know much about how that viewable() function works but is should restrict the query for items that the existing user has rights to.

I only did this for the recent and popular xml generation.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Okat
Okat's picture

Joined: 2009-04-05
Posts: 78
Posted: Mon, 2010-02-15 23:18

Version I downloaded after you applied the fix didn't contain those lines. Have downloaded again (just now) after a forced refresh (just in case) and they aren't there. Added them manually and can confirm it works. Maybe something went wrong while attaching the .zip the second time.

Btw, where did you learn the ORM::factory("item")->viewable() part? Am still trying to get a grip on Gallery 3 code and the latest I've heard about access and permissions is http://gallery.menalto.com/node/94063 where Bharat talks about Model based validation. Could not find any reference to any access/permission PHP code in http://codex.gallery2.org/Category:Gallery_3, or maybe I didnt' look/search well enough.

Thanks again. It's looking great.

My playground (using customized 3nids theme) http://www.okat.nl

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2010-02-16 03:22

I just checked the zip file attached above and I see the ->viewable() in controllers/photowidet.php so don't know why you don't.

I am a copy paste type of developer so I found:

      $children_count = ORM::factory("item")
        ->viewable()
        ->where("type", "!=", "album")
        ->count_all();

in the dynamic album modules code.
I did not know what ->viewable was so I searched the code for: 'function viewable(' and found:

  /**
   * Add a set of restrictions to any following queries to restrict access only to items
   * viewable by the active user.
   * @chainable
   */
  public function viewable() {
    return item::viewable($this);
  }

I am sure more docs will come, but I don't understand half the terminology and will not be writing it.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Tue, 2010-02-16 19:59

Like the module! Nice. Replaced the tags for now :)

  • Would it be possible to break admin sections in parts for each sideblock?
  • Would it be possbile block be selective? Turn off availability from the admin panel instead of having all 3 in widget section?
 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2010-02-16 20:22
Quote:
Would it be possible to break admin sections in parts for each sideblock?

Yes. I was thinking of that anyway and will do it in the future. The thing is you have to make 3 different forms to have the sections (more code).

Quote:
Would it be possbile block be selective? Turn off availability from the admin panel instead of having all 3 in widget section?

Currently the user can remove the block(s) he/she does not want via the Manage sidebar admim page.
Perhaps I will make some check-boxes so that on the admin page you will have the ability to choose the 'types' of pages it shows on ( photo or album pages )

I will be investigating making the sphere an ellipse so it might look better in the narrow sidebar.

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Tue, 2010-02-16 20:31
Quote:
Yes. I was thinking of that anyway and will do it in the future. The thing is you have to make 3 different forms to have the sections (more code).

Why? just different groups

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2010-02-17 20:23

Updated module to compartmentalize the blocks for easier administration. Thanks Serge D.
Added the ability to choose the type of page the block(s) should show on either photo collections or both via check-boxes on the admin page.

Any flash experts to help out in creating a different .swf movie? To help make an ellipse so it might look better in the narrow sidebar.
I have never developed flash stuff but here is some directions if you want to help out.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
h_s

Joined: 2009-06-26
Posts: 43
Posted: Wed, 2010-02-24 23:08

Dear Dave!

I enjoy your module a lot. I just found a little bug: the flash clouds stay on top of the cooliris slideshow (unless cooliris is maximised to full screen).

Cheers

h_s

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2010-02-25 01:11

I thought I fixed that. Do they stay over the top of other modal windows like the organize?

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2010-02-25 02:42

h_s,
I can't reproduce this issue. Do you have transparent mode set for the block?

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
h_s

Joined: 2009-06-26
Posts: 43
Posted: Thu, 2010-02-25 06:26

Dear Dave!

I tried it again with the transparent background. Works fine in Firefox 3.6, but has this overlay issue in Seamonkey 2.0.3. So, thats maybe a minor issue, because Seamonkey is not so popular as Firefox.

Thanks for your help,

h_s

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2010-02-25 06:56

I don't have that browser so you could see if changing the code in the view from transparent to opaque

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
h_s

Joined: 2009-06-26
Posts: 43
Posted: Thu, 2010-02-25 18:47

Dear Dave,

did that, but it didn't change anything. However, it is not such a big issue. Thanks for your help again!!

Have a nice day

h_s

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2010-02-25 21:33

Example URL I can't seem to reproduce.
Could be a browser issue as well.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
jokeofalltrades

Joined: 2010-03-03
Posts: 3
Posted: Fri, 2010-03-05 15:02

I love this module, but I have also noticed that it floats on top of the full-sized image (in both Firefox 3.5 and IE 8 on XP). See, for example, this picture - click on the picture to view full size, and make sure to resize the browser window so that the module overlaps with the full-size photo. Thanks for the great work!

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2010-03-05 16:31

Setting the block to transparent on the settings page seems to work for me:
http://www.langleycom.com/gallery3/index.php/53front
In your example I see that you have to set the block to transparent.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sat, 2010-03-06 07:41

Updated the module to remove data from the var table on deactivation.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
hebhansen
hebhansen's picture

Joined: 2009-02-10
Posts: 573
Posted: Sat, 2010-03-06 11:45

Very nice module Dave ...

Download in first post, is that the updated code?

all the best
HB - http://www.image.agentura.dk

 
mwilson_20

Joined: 2008-04-24
Posts: 2
Posted: Sat, 2010-03-06 16:57

Great job on porting this to gallery3... Really nice addition. Is it possible to enable a "lightbox" function depending on if your gallery3 theme is using one?

I have it enabled on my test site and haven't been able to figure out how or if its possible...

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sat, 2010-03-06 17:30
hebhansen wrote:
Download in first post, is that the updated code?

Yes.

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sat, 2010-03-06 17:32

@lightbox: No. Unless you are well versed at doing some flash development.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
jokeofalltrades

Joined: 2010-03-03
Posts: 3
Posted: Wed, 2010-03-10 15:28
floridave wrote:
Setting the block to transparent on the settings page seems to work for me:
http://www.langleycom.com/gallery3/index.php/53front
In your example I see that you have to set the block to transparent.

Yep, that worked. The widget is perfect as far as I can tell. Thanks!

 
mwilson_20

Joined: 2008-04-24
Posts: 2
Posted: Sat, 2010-03-20 16:54

@lightbox function... really wish I could work more with Flash than I can...

I was using the 3nids theme with the lightbox script for image viewing instead of the standard image page. I was hoping a change in the link value or something would allow an easier resolution but thanks for the feedback...

Still nice module just wanted to keep the image viewing the same for links etc...

My test Gallery3 installation: http://sandbox.wilsonwhirlwind.com/gallery3

 
inposure
inposure's picture

Joined: 2010-04-23
Posts: 304
Posted: Sun, 2010-05-02 04:33

A request:

drop ->where("type", "=", "photo") from recent_xml() and popular_xml() to include videos as well.

As a matter of fact, it could be configurable in the admin page, along with number of items to display.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2010-05-02 16:49

updated module to include videos as well.
Updated module admin page for quantity settings for recent and popular. Thanks for the suggestions inposure.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2010-07-08 21:32

fixed a typo in the version for module.info causing upgrade issues.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
DocMartin

Joined: 2005-07-13
Posts: 55
Posted: Tue, 2010-10-05 14:05

Nifty module - thanks!

 
gossamer

Joined: 2011-01-07
Posts: 47
Posted: Sat, 2011-01-15 17:29
Okat wrote:
Version I downloaded after you applied the fix didn't contain those lines. Have downloaded again (just now) after a forced refresh (just in case) and they aren't there. Added them manually and can confirm it works. Maybe something went wrong while attaching the .zip the second time.

Btw, where did you learn the ORM::factory("item")->viewable() part? Am still trying to get a grip on Gallery 3 code and the latest I've heard about access and permissions is http://gallery.menalto.com/node/94063 where Bharat talks about Model based validation. Could not find any reference to any access/permission PHP code in http://codex.gallery2.org/Category:Gallery_3, or maybe I didnt' look/search well enough.

Thanks again. It's looking great.

My playground (using customized 3nids theme) http://www.okat.nl

Hi, I really like your customized 3nids theme. Did you do this customization, or is it available in codex?

Thanks,
Alex

 
MCC-Nash

Joined: 2008-08-28
Posts: 10
Posted: Mon, 2011-02-14 05:35

hi guys,

i have a small problem, i used this plugin already before on my joomla 1.5 site, but now i upgraded to joomla 1.6 and now i always get the message "This widget requires Flash Player 9 or better" do i have to change any php settings or why is it not showing anymore in joomla.

if i add the code in the html window in the joomla window, joomla will rearange the code and i cant stop it from doing it...

does it not work anymore on joomla 1.6?

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2011-02-14 14:28

Are you using the 'external example' as described in http://codex.gallery2.org/Gallery3:Modules:photowidget

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
MCC-Nash

Joined: 2008-08-28
Posts: 10
Posted: Tue, 2011-02-15 00:03

yes, and it was working fine with joomla1.5 now i upgradet to 1.6 and it isnt working anymore, not even the flickr sphere is working from roytanck.com

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2011-02-15 01:15

Seems to be a joomla issue then. A real url might help, but I don't think I should be troubleshooting joomla issues as well.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
MCC-Nash

Joined: 2008-08-28
Posts: 10
Posted: Tue, 2011-02-15 07:10

i did a test created a empty page, outside of joomla, and inserted the code...but the only thing i got was the "flash-box" but no sphere inside.... hows that?

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2011-02-15 14:55

Works for me. http://www.langleycom.com/gallery3/test.html
do you have the module activated?

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
MCC-Nash

Joined: 2008-08-28
Posts: 10
Posted: Wed, 2011-02-16 01:34

yes the photowidget module is activated. do i need any other modules....?

i just used that code:

<object type="application/x-shockwave-flash"
data="http://EXAMPLE.com/gallery3/modules/photowidget/lib/photowidget.swf" width="200" height="200">
<param name="movie" value="http://EXAMPLE.com/gallery3/modules/photowidget/lib/photowidget.swf" />
<param name="bgcolor" value="#ffffff" />
<param name="AllowScriptAccess" value="always" />
<param name="flashvars" value="feed=http://www.EXAMPLE.com/gallery3/index.php/photowidget/recent_xml/" />
<p>This widget requires Flash Player 9 or better</p>
</object>

and only replaced the example with my site adress.

i cant get it to work, what am i doing wrong?

i tried diffrent browsers...

its showing yours just fine....

could it be any server setting in php.ini?

UPDATE

either i am totaly crazy and stupid or something weired is going on. i just put above mentioned code in a empty html page and uploaded it. the only thing i get is a white square of the flashplayer but no photos shown...

if i take the code and enter it in joomla sql database for that modul. it works fine, but as soon as i open this modul in joomla, all the code gets messed up by joomla again.

but why cant i view it on a empty html page? with just the code in there...

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2011-02-16 06:07

Do you get content when you visit
http://www.EXAMPLE.com/gallery3/index.php/photowidget/recent_xml
(Change EXAMPLE)
URLs would help diagnose your issue.

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
MCC-Nash

Joined: 2008-08-28
Posts: 10
Posted: Wed, 2011-02-16 06:12

hi dave

i get an xml feed with above link...

i got it running in joomla, i think i am just doing something wrong by creating the html page...

 
wise_mike

Joined: 2008-10-21
Posts: 158
Posted: Sat, 2011-02-19 05:26

Just tested the photowidget, and it is very nice..

Re using it at external pages other than the gallery root: how to make it show a certain album that I want, not just the recent images?
or in other words, to change that:

Quote:
<param name="flashvars" value="feed=http://sitename/Gallery/index.php/photowidget/recent_xml/" />

to the album of my choice?

Thanks,

 
wise_mike

Joined: 2008-10-21
Posts: 158
Posted: Sat, 2011-02-19 05:27

found it by trial and error.. should be:
http://sitename.com/Gallery/photowidget/xml/##.html
where the ## are the ID

 
wise_mike

Joined: 2008-10-21
Posts: 158
Posted: Sat, 2011-02-19 05:47

If a gallery has 100 images, this widget would choose something like the first 20 images to display, and each time the user open that album or any images from that album, would see the same images in the widget.. it would be nice that the widget could have some kind of random choices of images, or shuffle them or something.. what do you think?

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sat, 2011-02-19 06:23

glad you got the ID of the album sorted out.
@random: you could add another function in photowidget.php to do a random query. Look at the imageblock module to get a clue how that is done.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
wise_mike

Joined: 2008-10-21
Posts: 158
Posted: Sat, 2011-02-19 19:36

before I give it a try, does this random query for the whole gallery? or could it be for a particular album?

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sat, 2011-02-19 20:13

The imageblock does gets a ramdom from the whole gallery, it could be changed to get items from a specific album.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
wise_mike

Joined: 2008-10-21
Posts: 158
Posted: Sun, 2011-02-20 23:59

I noticed for two days the content of the "Popular items" doesn't change.. although the gallery had thousands of hots.. am I missing something?

Thanks,

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2011-02-21 03:52

it uses the view count for sorting.
is the XML file generated proper? example.com/gallery3/index.php/photowidget/popular_xml

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team