Has anyone got this working with 7.1 and PP 5.62
I have it working with 7.1 and PP 5.62 (integrated). I will try to provide as must information as possible. First, I am using Imagemagik instead of GD in my PP. I don't know if that makes any difference, but thought I'd mention it. Ok, here is exactly, in total, what I have in my Custom PAL (I've just changed some minor things for security reasons, but you will want to put your paths and database names in anyway):
require_once("/home/mysite/public_html/forums/photopost/inc_photopost.php");
$pp_db_prefix = "pp_";
function pp_get_ext( $filename ) {
return substr($filename, strrpos($filename,"."));
}
function pp_is_image( $filename ) {
$retval = 0;
$mediatypes = array( ".jpg", ".gif", ".png", ".bmp" );
$ext = pp_get_ext( $filename );
if ( in_array(strtolower($ext), $mediatypes) )
$retval = 1;
return( $retval );
}
$q_switch = "lastest";
switch ($q_switch) {
case "most_view":
$query = "SELECT p.id,p.user,p.userid,p.cat,p.title,p.bigimage,p.views
FROM {$pp_db_prefix}photos p
LEFT JOIN {$pp_db_prefix}categories c ON c.id=p.cat
WHERE c.password = ''
ORDER BY c.views DESC";
break;
case "lastest":
$query = "SELECT p.id,p.user,p.userid,p.cat,p.title,p.bigimage,p.views
FROM {$pp_db_prefix}photos p
LEFT JOIN {$pp_db_prefix}categories c ON c.id=p.cat
WHERE c.password = ''
ORDER BY date DESC";
break;
case "random":
$query = "SELECT p.id,p.user,p.userid,p.cat,p.title,p.bigimage,p.views
FROM {$pp_db_prefix}photos p
LEFT JOIN {$pp_db_prefix}categories c ON c.id=p.cat
WHERE c.password = ''
ORDER BY RAND()";
break;
}
$result = mysql_query($query);
$counted = 0; $featured = "";
while ( list($pid, $puser, $puserid, $pcat, $ptitle, $photo, $pviews) = mysql_fetch_array($result)) {
if ( pp_is_image($photo) ) {
$photolen = strlen($photo);
$theext = pp_get_ext($photo);
$photo_name = str_replace( $theext, "", $photo );
$temp_user = $line['userid'];
$thumbtag = "{$full_path}{$pcat}/thumbs/{$photo}";
$mthumb = "<img border="0" src="{$data_dir}{$pcat}/thumbs/{$photo}" alt="$thumbtag" />";
$featured .= <<<PPPRINT
<tr align="center"><td align="center" class="alt-1">
<a href="{$url_path}/showphoto.php?photo={$pid}">$mthumb</a><br>
by {$puser}
</td></tr>
PPPRINT;
$counted++;
}
if ( $counted == 5 ) break;
}
mysql_free_result($result);
mysql_select_db ("threads")or die("Could not select database");
$body = <<<PPPRINT
$featured
PPPRINT;
Notice that I am pointing to inc_photopost.php in the "Require_Once" statement above. This is a file that now comes with PP 5.62.
Within the file inc_photopost.php you will want to uncomment the database lines near the top of the file like this:
$link = mysql_connect ("localhost", "usernam", "password") or die('I cannot connect to the database.');
mysql_select_db ("photopost")or die("Could not select photopost database");
Be sure to edit to reflect YOUR user name and password for the PP database. Also, make sure the "photopost" database name is what you are using in the mysql_select_db statement.
Not also, you can change this line:
// which type of images do you want to show
$q_switch = "lastest"; (Yes, I know it is mispelled)
you can replace "lastest" with "random" or "most_view" depending on what category of images you want to pull from the PP database.
I hope this helps. It works fine for me,
Basil