Hello
I have question regarding zenphoto image discovery function
What I mean by discovery is when zenphoto discovers new images from a album folder and makes a mysql entry for them.
As zenphoto doesn't offer anonymous image upload i'am making my own script that basically just uploads the info into the zenphoto albums folder and then it would modify the appropriate title, desc, etc info in the photos mysql row.
But for that to happen i would like zenphoto to create the mysql row not my script to ensure maximum compatibility.
So the question being is there a special function or a page that i could include in my script that would make zenphoto create the mysql row for the new image?
would appriciate any help
Thank You
Comments
Thank You for the help. But i'am afraid my php skills are too weak to use that info in any useful way.
I would appriciate it creatly if anyone could give a piece of code that would need to be ran for the "zenphoto view image effect to work".
It would save me from requiering the zenphoto front page in a hidden div or doing something stupid like that
$newImage= newImage(new Album($_POST['album'], $_POST['album']), $image_name );
where the §_POST['album] contains the folder name that the image got copied and $image_name the filename of the new image.
Anyone confirm that this is not the complete wrong way?
Why do you need that actually? The images you have uploaded will be discovered automatically if someone views the album either on the backend or the frontend. If you use exif data Zenphoto will use that to generate the title, description.
Please take a look at the diagram here: http://www.zenphoto.org/2009/03/troubleshooting-zenphoto/#22
Edit: You should never use $_POST data directly, at least use our `sanitize()` function for security reasons.
If i create the MYSQL entry myself then Zenphoto won't add EXIF info. So it would be ideal for me if Zenphoto discovers the photo then makes MYSQL entry that my script can modify upon.
I'm very green with php so it takes some time to get my head around it.
Thanks for the help
My test code in Zenphoto works GREAT ... but when I use the exact same thing in my API it returns the "admin" or username.... I am stumped at this point any pointers?
=========================================
$id = "3370";
$row = query_single_row('SELECT '.prefix("images").'.id, '.prefix("images").'.filename, '.prefix("albums").'.folder FROM
'.prefix("images").' LEFT JOIN '.prefix("albums").' ON '.prefix("images").'.albumId = '.prefix("albums").'.id
WHERE
'.prefix("images").'.id='.$id, true);
$albumobject = new Album(new Gallery(),$row['folder']);
$imageobject = newImage($albumobject, $row['filename']);
$username = 'Joseph Philbert';
$commentText = 'HELLO Fing World';
//if ($image->filename)
$postcomment = $imageobject->addComment($username, 'jj@jj.com', '', $commentText, '','' , '', '', '', '');
echo 'postcomment '. $postcomment;
I guess I am also confused about your query. What exactly is it attempting to do? Looks like you are trying to get the image object from its ID? If so, maybe `getItemByID()` would be simpler.
Anyway I am getting the image object from the ID then using that the create an object ...then it helps me make all the other magic
Gonna start testing getItemByID() ...fun fun
Just for the record:
The comment form plugin registers the filter if it is running on a front-end page load. The front-end environment needs to be setup for the processing to work.
So now I get why that does not work ... I may have to make a custom mysql or php to post comments ...hmmm sucks ..
There is no reason why your script cannot run that way. If it is a THEME_PLUGIN or a CLASS_PLUGIN it will get loaded along with the front end.
It would be a really bad idea to make your own Mysql calls to post the comment--those are internal things and subject to change without notice. Really all you need is to insure that the comment form plugin registers its comment handling filter.
The plugin is not a "TRUE" plugin it just resides in the folder and loads the needed php files so it can communicate to Zenphoto
It loads:
"//
// make sure that the WEBPATH is set to parent directory for correct URL values
//
$dir = str_replace('\\', '/', realpath(dirname(__FILE__)));
define('SERVERPATH', strstr($dir, '/plugins/zp-lightroom', true));
require_once(SERVERPATH . '/zp-core/functions.php');
include_once(SERVERPATH . '/zp-core/template-functions.php');
require_once(SERVERPATH . '/zp-core/lib-auth.php');
include_once(SERVERPATH . '/plugins/zp-lightroom/IXR_Library.inc.php');"
Now I am wondering if theres any point making it partly a TRUE plug-in even partially just to get it to work hmmmm
https://github.com/philbertphotos/Zenphoto-Lightroom-Publisher/blob/3.02/zp-lightroom/xmlrpc.php
The down side of this is that if there ever is a competing comment form plugin that does not use this function.php script your plugin will probably fail. But I doubt that will ever be the case. Mostly people just customize the form itself.
`
define('OFFSET_PATH', 3);
require_once(dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME'])))."/zp-core/admin-globals.php");
`
Will get you setup with the global defines for ZENFOLDER, etc. and loading functions.php will establish the SERVERPATH define for you. (You could actually substitute `template-functions.php` for `admin-globals.php` above and get all the ZP stuff loaded.
Thanks...