durango99
06-29-2008, 03:46 PM
Hi,
I've just recently tested and worked with the flickr comment addon. Thanks to jdleung for the addon!
I've made 2 modifications to this addon and thought I'd post the changes in case anyone else is interested.
1. adding flickr photo id into IPTC change:
For me, I wasn't too excited manually adding the flickr photo ID number into each photo.
In my case, I also use the flickr importr pixelpost addon to work around not having to do this manual step. This is because importr has a extra database table (pixelpost_flickrassoc) that links the pixelpost photo id with the flickr photo id.
Deleting lines 21-33 =='' ) {....}] and adding the following in its place:
// The add-on will only run on pages showing an image
if(!isset($_GET['x']) OR (isset($_GET['showimage']) AND !isset($_GET['x']))) {
// Get Current Image.
if($_GET['showimage'] == "") {
$row = sql_array("select * from ".$pixelpost_db_prefix."flickrassoc order by pp_id DESC limit 0,1");
} else {
$row = sql_array("select * from ".$pixelpost_db_prefix."flickrassoc where (pp_id='".$_GET['showimage']."')");
}
}
$flickr_iptc_source = $row['flickr_id'];
[I]If people are interested, I could probably create a script that generates the flickr photo id to pixelpost id association like importr does (without having to use importr). As far as I can tell, the only way to do this is by title name. If the pixelpost photo title and flickr title are an exact match I could then create the association (not the best method, but doable).
2. comment performance:
I noticed that once implemented, flickr comment slowed down the page load for pixelpost. I believe the issue is code in flickr comment that does a lookup for each comment's author. The more comments, the longer this lookup would take.
I removed that extra lookup and that sped up page loads considerably. It should be actually fine that the comment author lookup is removed since there is plenty of author information within the comment data retrieve from flickr api.
change line 64:
$author = $f->people_getInfo($c['author']);
to
$author = $c['authorname'];
then change line 75:
$flickr_comments .= "<a href='".$author['photosurl']."' target='_blank'><b>".$author['username']."</a></b> @ ".$create_date."";
to
$flickr_comments .= "<b><a href='http://flickr.com/photos/".$c['author']."' target='_blank'>$author</a></b> @ $create_date<br>";
Hope that helps others out.
I've just recently tested and worked with the flickr comment addon. Thanks to jdleung for the addon!
I've made 2 modifications to this addon and thought I'd post the changes in case anyone else is interested.
1. adding flickr photo id into IPTC change:
For me, I wasn't too excited manually adding the flickr photo ID number into each photo.
In my case, I also use the flickr importr pixelpost addon to work around not having to do this manual step. This is because importr has a extra database table (pixelpost_flickrassoc) that links the pixelpost photo id with the flickr photo id.
Deleting lines 21-33 =='' ) {....}] and adding the following in its place:
// The add-on will only run on pages showing an image
if(!isset($_GET['x']) OR (isset($_GET['showimage']) AND !isset($_GET['x']))) {
// Get Current Image.
if($_GET['showimage'] == "") {
$row = sql_array("select * from ".$pixelpost_db_prefix."flickrassoc order by pp_id DESC limit 0,1");
} else {
$row = sql_array("select * from ".$pixelpost_db_prefix."flickrassoc where (pp_id='".$_GET['showimage']."')");
}
}
$flickr_iptc_source = $row['flickr_id'];
[I]If people are interested, I could probably create a script that generates the flickr photo id to pixelpost id association like importr does (without having to use importr). As far as I can tell, the only way to do this is by title name. If the pixelpost photo title and flickr title are an exact match I could then create the association (not the best method, but doable).
2. comment performance:
I noticed that once implemented, flickr comment slowed down the page load for pixelpost. I believe the issue is code in flickr comment that does a lookup for each comment's author. The more comments, the longer this lookup would take.
I removed that extra lookup and that sped up page loads considerably. It should be actually fine that the comment author lookup is removed since there is plenty of author information within the comment data retrieve from flickr api.
change line 64:
$author = $f->people_getInfo($c['author']);
to
$author = $c['authorname'];
then change line 75:
$flickr_comments .= "<a href='".$author['photosurl']."' target='_blank'><b>".$author['username']."</a></b> @ ".$create_date."";
to
$flickr_comments .= "<b><a href='http://flickr.com/photos/".$c['author']."' target='_blank'>$author</a></b> @ $create_date<br>";
Hope that helps others out.