![]() |
|
lightbox manager plugin - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: Plugins (https://forum.zenphoto.org/forum-6.html) +--- Thread: lightbox manager plugin (/thread-7059.html) Pages:
1
2
|
lightbox manager plugin - frankm - 17-05-2010 hi, i would like to add a "lightbox" functionality to zenphoto. i mean a lightbox in the photographic way. basically it would allow user to select pictures to put in their lightbox for later review. from within the lightbox the user could then refine and remove unwanted images before saving the lightbox and getting a url pointing to it. i'd like to do that as a plugin but like i said in one of my other posts, i am not a php developper and hardly a php coder. anyway i think it could be something nice to get me started. i have read the recommandations on how to write a plugin but i still have questions. from what i've read so far, i will need php session variable to track the user and its lightbox. is this possible to do that in a plugin. or should i use some global variables in that case how do i make sure they will be known everywhere. do you have any plugin in mind that uses the same idea and which i could look at to get started. well thanks for your tips and avices. lightbox manager plugin - acrylian - 17-05-2010 That's quite a task if you are not a php developer.... Global variables would not work as they are dependend in instances that need to be setup. A session/cookie would be the best I think and I see no reason why that would not work with a plugin. We have no plugin that does similar things. The rating is similar however it saves into the database and is not really user dependend. lightbox manager plugin - frankm - 23-05-2010 hi, looking how to implement this lightbox manager. i need to identify the user by the session id number so that he can only add/remove images to his/her lightbox. for that i guess i need the also, this "lightbox" manager requires a new table in the database to store the information relative to the lightbox (id, user_id, image_id's). i could create the table through my phpadmin page but i'd like the table creation to be done when we activate the plugin. is this possible ? if yes where should i place the mysql_query ? thanks for your help. lightbox manager plugin - acrylian - 23-05-2010 I will pass the question about the session stuff to my collegue sbillard. Regarding the table: You could place that MySQL query on the beginning of your plugin file: If it does not exist create it otherwise do nothing. Note that Zenphoto uses the filename and the album (folder) name are the unique values to identify an element, not the id. Using those two will help you with displaying the actual selected items since you should use the object model for that. Also take a look at the documenation as we have some functions for databases. lightbox manager plugin - frankm - 23-05-2010 thanks. i have already looked into function-db.php to see what were the zenphoto functions for databases and i'm working from that. your remark on the filenames being the unique values to identify an element confuses me a bit. do you mean the image filename is the unique value ? because reading the documentation i found the well thanks for your help and i am waiting for sbillard comment on starting the session. lightbox manager plugin - acrylian - 23-05-2010 Yes, there is an unique id of course. But since you probably want to show the images selected in the lightbox manager you will need to use the object model to do that (at least I recommend not to query via the db) and that does not use the id but the album name and filename (as images and albums are filesystem based). Using the object model saves a little work. Take a look at the object model tutorial. lightbox manager plugin - sbillard - 23-05-2010 Zenphoto will create front-end sessions if you set the gallery session option. You would need to use lightbox manager plugin - frankm - 24-05-2010 hi, trying to find my way with the object model without lots of success so far. for what i understood, going to the object model will allow me to use the if i want to create a "new" album that will hold the lightbox images i guess i should do something like this: do i have to create a new gallery too or can i just put $_zp_gallery in there ? yet the major problem is that this "lightbox" album has no real existence and i am not sure i can do it this way. assuming i have a folder to hold my images, do i have simply to loop through my thanks for your help and pointing me to the right direction because i've the feeling i am losing it ! lightbox manager plugin - frankm - 24-05-2010 i think i'm back on track. hopefully i'll get something working very soon and maybe then i'll need some comments on how to make the code better. i'll let you know. lightbox manager plugin - acrylian - 24-05-2010 The object model is not specififially for the next_image() loop only. It is a good way to get other info of an image like the filename, title, date, tags or whatever. YOu can do all this via the db but the object model is quite easier and cleaner to use (once you got it). $_zp_gallery is as a global object for the gallery always available on teh theme files. Just take a look at other plugins how they use it. lightbox manager plugin - frankm - 24-05-2010 hi, i still have a little problem. basically i have 2 files. in the custom lightbox.php file i have done some thing like this:
and later on `
i am not sure if this is clear, hopefully it is. lightbox manager plugin - acrylian - 24-05-2010 Looks good so far. To get lightbox manager plugin - frankm - 24-05-2010 thanks. that's what i was thinking to do at the end having found no other method. lightbox manager plugin - acrylian - 24-05-2010 Another way would have been to declare $obj global but passing as a parameter seems to be the best. lightbox manager plugin - frankm - 25-05-2010 hi, the lightbox manager is kind of working. i would like to add some pagination to it and i was wondering if i have to hard code it in my "display" page or if i could turn the selected images into a "virtual" album and use the build-in function thanks. lightbox manager plugin - frankm - 25-05-2010 i have an issue. basically what i do right now when some click the "add to lightbox" button is to run the addImage function which as the end send me back to where i come from through the however i wanted to add the "lightbox +" button to each image in a search result. and this is where i have the problem. the thanks. lightbox manager plugin - acrylian - 25-05-2010 Dynamic albums are generated from search results (http://www.zenphoto.org/2008/09/how-to-use-the-dynamic-albums-feature/). So without a search this won't probably work. Regarding pagination, that is not really that hard to do via MySQL and PHP directly. Regarding images in searches. Search and other things works with contexts. That is why it is lost if you redirect. Maybe it would be an idea to open the lightbox manager in a Colorbox window directly without leaving the page at all? lightbox manager plugin - frankm - 25-05-2010 concerning the last point what i have done is save the $_POST['words'] in a $_SESSION variable that keeps the last search and if i add image from a search i redirect the script with the it does work, though it might not be the best way to do it. and for the pagination, i'll work on it. lightbox manager plugin - frankm - 26-05-2010 hi, got the pagination working. thanks for giving me directions. i have a question about session id's. i want to use this to identify a user so that he/she can only add images to the lightbox he/she has created. for now i am developping the website on a local server. basically i work on a mac with mamp installed. for now i am the only user and no matter what i do i always the same session id. i thought i should get a new one when i close the browser and open it again. but this is not the case. is it normal ?? is it an issue with safari that i use ? thanks. lightbox manager plugin - acrylian - 26-05-2010 I am also doing bascially all developing on MAMP. Regarding the session, you are always the same IP/computer so that sounds logical for me. (Not the expert on sessions stuff though). I just got the idea that you might not need sessions at all. You can always get the currently logged in user, so if you create the table entries assigned to that currently logged in user as a field you might be able to work without them. There is a global object available |