Ah, thanks a lot. I tried to find that phrase within the code. But it is a lot easier to change the value on the plugin options page Thank you for the explanation.
First of all, the plugin is very awesome. I am implementing it right now to make a blog of nothing but pictures. However, because I am making plans on heavily using it to the extent where I have to use one album per blog post, I was wondering if there's any way to apply hierarchy on the album drop down menu. Because I plan to create an album per blog post, I'm a bit concerned that the drop down menu will get overpopulated.
I was thinking of making use of subfolders where each album I make will be placed. Is there anyway to have a menu that will first prompt for a folder, then prompt for a subfolder so that all my albums don't show on the drop-down at the same time?
@komatome: yes, there's a way. Actually, it's already implemented in the Development Version (see http://wordpress.org/extend/plugins/zenphotopress/download/ ). The multiple-steps menu should be possible, but you'll have to edit the code of the plugin to get it (i.e. you'll have to write the code yourself).
@everyone else: I'll try to release a new version ASAP, to fix compatibility with 1.2.6.
First, excellent plug-in! It's just what I needed to be able to move away from G2. One suggestion though. Would it be possible to add an option to the admin page so you can link directly to image? Right now the "link to image" option goes to the image page.
I'm having problems with the plugin. Could someone help? When I press the ZP button, the screen shows up but I don't get a drop down box. The box is empty. I ran it in debug mode and this is what I get.
ZenphotoPress Messages
INFO
PHP Version: 5.2.9
INFO
Current working directory: /home/phoubarc/public_html/wp/wp-content/plugins/zenphotopress/tinymce
had the same issues at first, it's because zenphoto is storing zp-config.php in zp-data folder instead of the zp-core. Until the code is changed could either copy it over to zp-core, or point it at the zp-data folder. I just copied it back fo the zp-core folder for now, works fine.
The most interesting changes: - Support for Zenphoto 1.2.6 (just re-run the ZenphotoPress configuration) - Support for WP 2.8 widgets, which means multiple widgets are now a possibility - Important security fixes: images from protected/unpublished albums will be kept private - Support for subalbums: the albums list now shows nesting relationships Plus, a couple of bugfixes.
Hi Simbul, works fine for me. Thank's a lot for the update and your great plugin
I deactivated the old version, deleted all zenphotopress files and copied the new ones, activated the plugin and it works without any modifications - just as expected. Btw: I'm running my site with the latest versions of wordpress and zenphoto.
I was happy to see the update announced and installed right away because the plugin stopped working after update to Zenphoto 1.2.6. Now I have installed version 1.6 of the plugin, WordPress 2.8.4 and Zenphoto 1.2.6 and it still doesn't work. :-(
I already updated the plugin settings, but I still get an empty dropdown menu with no listed albums and the widget doesn't work either. Debug mode does show the messages already stated here but does not really help. My WP plugins folder is not password protected. I double checked the path to the zp-data folder and it is the right one. Please give me a hint what information I should provide to track down this error.
The address of the blog is www.lespocky.de/blog and the address of the fotos is www.lespocky.de/fotos. As you can see above both applications are installed in different subfolders but on the same domain. As you can see WordPress is installed in a subfolder as suggested here. (I changed the real foldernames above to XXXX.)
Fatal error: Call to undefined function mysql_set_charset() in /var/www/www.lespocky.de/blog/_wordpress_XXXX/wp-content/plugins/zenphotopress/zenphoto_bridge.php on line 436
According to PHP Manual the function mysql_set_charset was introduced in PHP 5.2.3 but we still use the patched 5.2.0 from Debian Etch. A grep in the blog sources showed WordPress itself does a test on this function in wp-includes/wp-db.php line 360 (WordPress 2.8.4) so perhaps you can do something similar in the plugin?
@LeSpocky: nice debugging. It should be fixed in the development version, give it a run.
I had to search a little for the development version but finally found it on the plugin page on wordpress.org by clicking other versions. I installed this version and the plugin works again as it should. New photos are displayed in the widget and I can use the editor component as before with Zenphoto 1.2.5 and Zenphotopress 1.5.x.
going to the first URL results in .php being added to the end and the image page loading.
it looks like zenphotopress is trying to put 'albums' between .com and nature, but then it doesn't? after inserting the thumbnails, I change the link to include 'albums' and everything works fine. Without doing this, I get the a lightbox square with a spinning icon - probably because it loaded the image page instead of the image itself.
I'm using the latest ZP, ZPP and WP - just upgraded them all last night. If you can give me a hand (is it a ZP setting?) I'd appreciate it. Not that it's a huge issue - like I said, changing the link to work isn't difficult, it's just an extra step.
Looks like things are working fine zetetic, I assume you have the lightbox 2 plugin for wordpress running? Cause what you assumed is correct. Lightbox is just trying to load the image.php page. You could set it for a custom link via the zenphotopress.
In the long run I ended up just skinning my zen & wordpress to a similar theme and turned off lightbox.
I've been trying to get this plugin working on my local Windows box and running into problems. WP 2.8.4, ZP 1.2.6, ZPP 1.6.
First problem was that no albums were appearing in the dropdown. I found that the ZenphotoPressAlbum.to_hash method in zenphoto_bridge.php was referencing $this->parentid when I think it should have been using $this->p_id? Anyway, changing this made the error go away.
Next problem I haven't been able to resolve. Its occurring during retrieval of images. The URL is:
And the error that gets returned is: Notice: Undefined index: parentid in C:\programs\wamp\www\wordpress\wp-content\plugins\zenphotopress\zenphoto_bridge.php on line 305
Line numbers may not match up with the released version cause I've been messing with the file a bit, but it's the line in album_protected_recursive that reads: ` if ($query['parentid']) { return album_protected_recursive($query['parentid']); ` Any help much appreciated, thanks!
Not sure myself.. it worked just fine on my install... though if you've changed the first parentid to p_id, you'd have to change the second though as the error you're getting is saying that parentid isn't defined. The bigger question you should be looking at is why you had to change the parentid to p_id. Did you make other coding changes requiring it?
Nope didn't make any other coding changes requiring it. FYI here's the unmodified code straight from the ZPP zip I downloaded:
` class ZenphotoPressAlbum { var $id; var $name; var $children; var $p_id;
/** * Class constructor. Create a new album from a has of values. * @param $hash Hash of values */ function ZenphotoPressAlbum($hash) { $this->id = $hash['value']; $this->name = $hash['name']; $this->p_id = $hash['parentid']; $this->children = $hash['children']; }
/** * Add an album as a child to this album. * @param $child A ZenphotoPressAlbum instance */ function add_child($child) { $this->children[$child->id] = $child; }
/** * Return a hash representation for this album. * This method is the dual of the class constructor. * @return A hash representing the album */ function to_hash() { $out = array(); $out['value'] = $this->id; $out['name'] = $this->name; $out['parentid'] = $this->parentid; $out['children'] = NULL; if ($this->children != NULL) { foreach($this->children as $id => $child) { $out['children'][$id] = $child->to_hash(); } } return $out; } } ` Note the declaration of the variable as p_id at the top and the use of "$this->parentid" at the bottom in to_hash (this was the line that was causing me problems).
I can't understand why nobody else is getting this problem though. Maybe I'm using a bogus download.
Hmm, just downloaded ZPP again from the wordpress plugin site - the code I posted above is definitely what's on there. I'm not a PHP coder, so I can't really say for certain, but that code sure looks suspicious to me. Is there a dev version I can download from somewhere?
Update: This problem (using parentid instead of p_id) is fixed in the development version. Maybe nobody else is seeing it because they're not using nested albums? Anyway FWIW version 1.6 appears to be broken for certain use cases (nested albums?).
I'm still left with the problem retrieving images however, as I described above.
Maybe I'll try without nested albums and see if that's any better.
Sorry for the forum spam. I found the problem - there's a bug(?) in the ZPP code in album_protected_recursive (zenphoto_bridge.php). The code reads like this at present:
` $sql = "SELECT id, parentid FROM db_albums_table AS a WHERE a.password='' AND a.show=1 AND a.id=$albumid";
$query = $zp_db->queryArray($sql); if (count($query) == 0) { return true; } else { if ($query['parentid']) { return album_protected_recursive($query['parentid']); } } ` Trouble is the query (in my environment at least) returns an array of arrays ([[id,parentid]]), so when you try to dereference the results it with just $query['parentid'] it returns an error. I change this to $query[0]['parentid'] and it worked.
I had a cursory glance at the code and it seems you are right. It appears that, when I tested the latest version, I was actually never executing the else clause.
Thanks for finding the bug. By the way, how is your gallery structured (albums/subalbums)? It seems I never took it into the due consideration.
Thanks Simbul for the reply. I am able to replicate this problem with a single album only with two images in it, no password, "show=1". Here's the row from the albums table:
Comments
It's the second option on the top of the page
Thank you for the explanation.
First of all, the plugin is very awesome. I am implementing it right now to make a blog of nothing but pictures. However, because I am making plans on heavily using it to the extent where I have to use one album per blog post, I was wondering if there's any way to apply hierarchy on the album drop down menu. Because I plan to create an album per blog post, I'm a bit concerned that the drop down menu will get overpopulated.
I was thinking of making use of subfolders where each album I make will be placed. Is there anyway to have a menu that will first prompt for a folder, then prompt for a subfolder so that all my albums don't show on the drop-down at the same time?
The multiple-steps menu should be possible, but you'll have to edit the code of the plugin to get it (i.e. you'll have to write the code yourself).
@everyone else: I'll try to release a new version ASAP, to fix compatibility with 1.2.6.
When I press the ZP button, the screen shows up but I don't get a drop down box. The box is empty. I ran it in debug mode and this is what I get.
ZenphotoPress Messages
INFO
PHP Version: 5.2.9
INFO
Current working directory: /home/phoubarc/public_html/wp/wp-content/plugins/zenphotopress/tinymce
INFO
POST:
INFO
GET: Array ( [tinyMCE] => 1 [ver] => 3241-1141 )
INFO
ZenphotoProxy method: cURL
INFO
ZenphotoProxy call: http://phoubar.com/wp/wp-content/plugins/zenphotopress/zenphoto_bridge.php?function=get_albums&admin_path=
had the same issues at first, it's because zenphoto is storing zp-config.php in zp-data folder instead of the zp-core. Until the code is changed could either copy it over to zp-core, or point it at the zp-data folder. I just copied it back fo the zp-core folder for now, works fine.
http://wordpress.org/extend/plugins/zenphotopress/
The most interesting changes:
- Support for Zenphoto 1.2.6 (just re-run the ZenphotoPress configuration)
- Support for WP 2.8 widgets, which means multiple widgets are now a possibility
- Important security fixes: images from protected/unpublished albums will be kept private
- Support for subalbums: the albums list now shows nesting relationships
Plus, a couple of bugfixes.
As usual, let me know if everything works for you
works fine for me. Thank's a lot for the update and your great plugin
I deactivated the old version, deleted all zenphotopress files and copied the new ones, activated the plugin and it works without any modifications - just as expected. Btw: I'm running my site with the latest versions of wordpress and zenphoto.
Thank you very much!
stef
I already updated the plugin settings, but I still get an empty dropdown menu with no listed albums and the widget doesn't work either. Debug mode does show the messages already stated here but does not really help. My WP plugins folder is not password protected. I double checked the path to the zp-data folder and it is the right one. Please give me a hint what information I should provide to track down this error.
`
ZenphotoPress Messages
INFO
PHP Version: 5.2.0-8+etch15
INFO
Current working directory: /var/www/www.lespocky.de/blog/_wordpress_XXXX/wp-content/plugins/zenphotopress/tinymce
INFO
POST:
INFO
GET: Array ( [tinyMCE] => 0 )
INFO
ZenphotoProxy method: cURL
INFO
ZenphotoProxy call: http://www.lespocky.de/blog/_wordpress_XXXX/wp-content/plugins/zenphotopress/zenphoto_bridge.php?function=get_nested_albums&data_path=/var/www/www.lespocky.de/fotos/zp-data
`
The address of the blog is www.lespocky.de/blog and the address of the fotos is www.lespocky.de/fotos. As you can see above both applications are installed in different subfolders but on the same domain. As you can see WordPress is installed in a subfolder as suggested here. (I changed the real foldernames above to XXXX.)
Can someone help me with another issue? I'm trying to use lightbox with zenphotopress. When I click on the picture for zp it gives me this code.
a href="http://www.phoubar.com/zp/random/RockClimbing38.jpg"><img class="ZenphotoPress_thumb " alt="RockClimbing38" title="RockClimbing38" src="http://www.phoubar.com/zp/random/image/thumb/RockClimbing38.jpg"
and then I have to go in and manually place rel='lightbox' and change the link to direct it to the full image. Like so.
a href="http://www.phoubar.com/zp/albums/random/RockClimbing38.jpg" rel='lightbox'><img class="ZenphotoPress_thumb " alt="RockClimbing38" title="RockClimbing38" src="http://www.phoubar.com/zp/random/image/thumb/RockClimbing38.jpg"
Is there an easier way to automate this? Can I change the code somewhere to give me this result?
@phoubar: You could add your rel to tinymce/js/functions.js:102. Keep in mind that it won't work with the widget or the shortcode, however.
Thank you very much for the quick bugfix. :-)
As others have said, thank you for the plugin!
I have encountered a small error though: the default link to image option enters a URL to the image page, not the image itself. Meaning, it will put the following link:
http://photography.outonabender.com//nature/looking-up/IMG_1973-Large.jpg
instead of
http://photography.outonabender.com/albums/nature/looking-up/IMG_1973-Large.jpg
going to the first URL results in .php being added to the end and the image page loading.
it looks like zenphotopress is trying to put 'albums' between .com and nature, but then it doesn't? after inserting the thumbnails, I change the link to include 'albums' and everything works fine. Without doing this, I get the a lightbox square with a spinning icon - probably because it loaded the image page instead of the image itself.
I'm using the latest ZP, ZPP and WP - just upgraded them all last night. If you can give me a hand (is it a ZP setting?) I'd appreciate it. Not that it's a huge issue - like I said, changing the link to work isn't difficult, it's just an extra step.
Thanks!
In the long run I ended up just skinning my zen & wordpress to a similar theme and turned off lightbox.
Anyway, support for Lightbox and the likes has been in my todo list for a reeeeally long time. I hope to bring it to the "completed features" soon
Simbul: that makes sense then. thanks for the enlightenment! let us know when that feature makes it's way into the plugin. thanks for writing this!
and thanks to both of you for responding
First problem was that no albums were appearing in the dropdown. I found that the ZenphotoPressAlbum.to_hash method in zenphoto_bridge.php was referencing $this->parentid when I think it should have been using $this->p_id? Anyway, changing this made the error go away.
Next problem I haven't been able to resolve. Its occurring during retrieval of images. The URL is:
http://localhost/wordpress/wp-content/plugins/zenphotopress/zenphoto_bridge.php?albumid=1&sort=sort_order&start=0&limit=10&function=get_images&data_path=C:\programs\wamp\www/zenphoto/zp-data
And the error that gets returned is:
Notice: Undefined index: parentid in C:\programs\wamp\www\wordpress\wp-content\plugins\zenphotopress\zenphoto_bridge.php on line 305
Line numbers may not match up with the released version cause I've been messing with the file a bit, but it's the line in album_protected_recursive that reads:
`
if ($query['parentid']) {
return album_protected_recursive($query['parentid']);
`
Any help much appreciated, thanks!
`
class ZenphotoPressAlbum {
var $id;
var $name;
var $children;
var $p_id;
/**
* Class constructor. Create a new album from a has of values.
* @param $hash Hash of values
*/
function ZenphotoPressAlbum($hash) {
$this->id = $hash['value'];
$this->name = $hash['name'];
$this->p_id = $hash['parentid'];
$this->children = $hash['children'];
}
/**
* Add an album as a child to this album.
* @param $child A ZenphotoPressAlbum instance
*/
function add_child($child) {
$this->children[$child->id] = $child;
}
/**
* Return a hash representation for this album.
* This method is the dual of the class constructor.
* @return A hash representing the album
*/
function to_hash() {
$out = array();
$out['value'] = $this->id;
$out['name'] = $this->name;
$out['parentid'] = $this->parentid;
$out['children'] = NULL;
if ($this->children != NULL) {
foreach($this->children as $id => $child) {
$out['children'][$id] = $child->to_hash();
}
}
return $out;
}
}
`
Note the declaration of the variable as p_id at the top and the use of "$this->parentid" at the bottom in to_hash (this was the line that was causing me problems).
I can't understand why nobody else is getting this problem though. Maybe I'm using a bogus download.
Update: This problem (using parentid instead of p_id) is fixed in the development version. Maybe nobody else is seeing it because they're not using nested albums? Anyway FWIW version 1.6 appears to be broken for certain use cases (nested albums?).
I'm still left with the problem retrieving images however, as I described above.
Maybe I'll try without nested albums and see if that's any better.
Update2: Still no good without nested albums.
`
$sql = "SELECT id, parentid
FROM db_albums_table AS a
WHERE a.password='' AND a.show=1 AND a.id=$albumid";
$query = $zp_db->queryArray($sql);
if (count($query) == 0) {
return true;
} else {
if ($query['parentid']) {
return album_protected_recursive($query['parentid']);
}
}
`
Trouble is the query (in my environment at least) returns an array of arrays ([[id,parentid]]), so when you try to dereference the results it with just $query['parentid'] it returns an error. I change this to $query[0]['parentid'] and it worked.
Thanks for finding the bug.
By the way, how is your gallery structured (albums/subalbums)? It seems I never took it into the due consideration.
1,NULL,test,testing,,2007-10-28 15:03:52,,1,0,1,,NULL,,,NULL,0,0,1,,,0,0,NULL,,0,NULL,NULL,,0,3,,