PhotoPost Photo Gallery Sales PhotoPost Sales Toll Free Phone Number
Mon-Fri 9am-4pm EST
  PhotoPost Photo Sharing Photo Gallery    Visualize community tm
| | | | | | | | |

Go Back   PhotoPost Community > PhotoPost Support > PhotoPost Pro Support Forums > Photopost Pro Installation & Upgrades

Photopost Pro Installation & Upgrades If you're having install or upgrade problems

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
Old August 22nd, 2005, 07:23 AM   #1 (permalink)
Registered User
 
Join Date: Jan 2005
Posts: 9
a little help..

Is there anybody can help me?

I used this hack to get the random images n my pp directory

the problem is there is no thumbnail in my random images..


<?
$Url_Path = "http://www.mydomain.com/photopost/"; //URL of your photo album, where the index.php is (with / at end)
$data_dir = "http://www.mydomain.com/photopost/data/" ; //URL of your photo dir where those jpeg stored (with / at end)
$images_dir =$Url_Path."images/"; //URL of your photopost images dir where default missing thumb image is stored (with / at end)
$rel_dir = "/YOURPATH/gallery/data/"; // path to the data directory where pictures reside RELATIVE
// to the location of THIS file (used for checking thumbs)
//Database Setting
//You must change these values in order to run this script
//These value are not visible in the output page source

$host = "*******"; //Server Name
$user= "**********"; //Username
$password= "****"; //Password
$database="*******"; //Photopost database name or forum database name

//Display Setting (Changes to fit your page)
$q_switch = "random"; // "random" or "most_views" or "latest"
$limit = 4; //number of image to show
$table_width = "100%"; //width of the table generated
$column = 4; //number of columns of the table generated
$photo_cell_align = "center"; //alignment of those cells

// CSS Setting (optional)
$class_link = ""; //css for link, leave blank if none
$class_table = ""; //css for table, leave blank if none
$class_mouseover = ""; //color when mouse over the photo cell, leave blank if to cancel

// *************************************************************************
// *************************************************************************

///////////don't edit below this line if you are too afraid to kill the code//////////////
// ---------------------- THESE FUNCS FROM pp-inc -----------------

function mysql_query_eval( $query, $database ) {
global $Globals;

$mysql_eval_error="";
$mysql_eval_result = mysql_query($query, $database) or $mysql_eval_error = mysql_error();
if ($mysql_eval_error) {
if ( $Globals{'debug'} == 1 ) {
$letter = "An error was encountered during execution of the query:\n\n";
$letter .= $query."\n\n";
$letter .="The query returned with an errorcode of: \n\n$mysql_eval_error\n\n";
$letter .= "If you need assistence or feel this is a 'bug'; please report it to our ";
$letter .= "support forums at: http://www.techimo.com/forum/f27/index.html\n\n";
$letter .= "To turn off these emails, set \$debug=0 in your config-inc.php file.";

$email = $Globals{'adminemail'};
$email_from = "From: ".$Globals{'adminemail'};

$subject="Subject: ".$Globals{'webname'}." MySQL Error Report";
$subject=trim($subject);

mail( $email, $subject, $letter, $email_from );
}
elseif ( $Globals{'debug'} == 2 ) {
dieWell( "MySQL error reported!<p>Query: $query<p>Result: $mysql_eval_error<p>Database handle: $database" );
exit;
}
return FALSE;
}
else {
return $mysql_eval_result;
}
}

function get_ext( $filename ) {
$photolen = strlen($filename);
$RetVal = substr( $filename, $photolen-3, $photolen);

return $RetVal;
}

function get_filename($filename) {
// strip off the last 4
$len = strlen( $filename )-4;
$RetVal = substr( $filename, 0, $len);
return $RetVal;
}


// ---------------------- THESE FUNCS FROM pp-inc -----------------
// Connecting, selecting database
$link = mysql_connect ("$host", "$user", "$password") or die ('I cannot connect to the database.');
mysql_select_db ("$database")or die("Could not select database");

// Here is the hacked up display_gallery($q_switch)

$catquery="";

if ( IsSet($cat) ) {
$querya="SELECT catname FROM photopost_categories WHERE id=$cat";
$catq = mysql_query_eval($querya,$link);
$catr = mysql_fetch_array($catq);
$catname = $catr['catname'];
mysql_free_result($catq);


$queryb = "SELECT id FROM photopost_categories WHERE parent='$cat' ORDER BY catorder ASC";
$boards = mysql_query_eval($queryb,$link);
$cnt=0;
while ( $row = mysql_fetch_array($boards, MYSQL_ASSOC)) {
$catqid = $row['id'];
if ( $cnt == 0 ) {
$cnt=1;
$catquery .= "$catqid";
}
else {
$catquery .= ",$catqid";
}
}
mysql_free_result($boards);
}



// Connecting, selecting database

// Selecting method and Perform SQL query


switch ($q_switch) {
case "most_views":
if ( !IsSet($cat) ) {
$group_title = "Most Popular Images - All Categories";
$query = "SELECT id,user,userid,cat,title,bigimage,views FROM photopost_photos WHERE bigimage!='' AND approved='1' $exclude_cat ORDER BY views DESC LIMIT $limit";
}
else {
$query = "SELECT id,user,userid,cat,title,bigimage,views FROM photopost_photos WHERE bigimage!='' AND approved='1' $exclude_cat AND cat in ($catquery) ORDER BY views DESC LIMIT $limit";
$group_title = "Most Popular Images - $catname";
}
break;
case "latest":
if ( !IsSet($cat) ) {
$group_title = "Most Recent Images - All Categories";
$query = "SELECT id,user,userid,cat,title,bigimage,views FROM photopost_photos WHERE bigimage!='' AND approved='1' $exclude_cat ORDER BY date DESC LIMIT $limit";
break;
}
else {
$group_title = "Most Recent Images - $catname";
$query = "SELECT id,user,userid,cat,title,bigimage,views FROM photopost_photos WHERE bigimage!='' AND approved='1' $exclude_cat AND cat in ($catquery) ORDER BY date DESC LIMIT $limit";
break;
}
break;
default:
if ( !IsSet($cat) ) {
$group_title = "Random Images - All Categories";
$query = "SELECT id,user,userid,cat,title,bigimage,views FROM photopost_photos WHERE bigimage!='' AND approved='1' $exclude_cat ORDER BY RAND() DESC LIMIT $limit";
break;
}
else {
$group_title = "Random Images - $catname";
$query = "SELECT id,user,userid,cat,title,bigimage,views FROM photopost_photos WHERE bigimage!='' AND approved='1' $exclude_cat AND cat in ($catquery) ORDER BY RAND() DESC LIMIT $limit";
break;
}
break;
}


$i = 1;
$e = 2;
$col_val = $column;
$result = mysql_query_eval($query,$link) or die("Query failed");
print "<table class=\"".$class_table."\" width=\"".$table_width."\"><tr>";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$photo_name = get_filename( $line['bigimage'] );
print "<td onmouseover=this.style.background='".$class_mouseover."' onmouseout=this.style.background='' align=\"center\">";
$theext = get_ext( $line['bigimage'] );
$thecat = $line['cat'];
$temp_user = ($line["userid"]);
$filepath = "$data_dir"."$thecat/thumbs/$photo_name.$theext";
$rel_path = "$rel_dir"."$thecat/thumbs/$photo_name.$theext";
print "<A class=\"$class_link\" href=\"$Url_Path"."showphoto.php?photo=".$line['id']. "\">";
if ( file_exists( $rel_path ) )
print "<img border=\"0\" src='$filepath'>";
else
print "<img border=\"0\" src='".$images_dir."nothumb.gif' alt='$filepath'>";
print "<Font size=\"1\"color=\"".$Globals{'maintext'}."\" face=\"verdana,arial\">\n";
if ($q_switch == "most_views") {
print "<br>".$line["title"]."<br>".$line["views"]." views";
print "</a><br></font></div><br>";
} else {
print "<br>".$line["title"];
print "</a><br></div><br>";
}
if ($i == "$column") {
print "</td></tr><tr>";
$column = $col_val*$e;
$e++;
} else {print "</td>";}
$i++;
}

print "</tr></table><center>Random Images from our Gallery</font></center> ";

// Closing connection
mysql_close($link);
// mysql_close($db_link);


?>


thanksss

Last edited by jalmz_lira_jull; August 24th, 2005 at 12:28 AM.
jalmz_lira_jull is offline   Reply With Quote
Old August 23rd, 2005, 08:46 AM   #2 (permalink)
Photopost Developer
Verified Customer
 
Chuck S's Avatar
 
Join Date: Jun 2002
Location: Abingdon,MD
Posts: 71,947
Hello you can post hack questions over at the site http://www.photopostdev.com

however an easy hint here you no longer have to get the file extention so

$photo_name = $line['bigimage']'

$filepath = "$data_dir"."$thecat/thumbs/$photo_name";
$rel_path = "$rel_dir"."$thecat/thumbs/$photo_name";
__________________
Photopost Developer and Support Engineer

Please do not PM me for support or sales questions. Thank you for your understanding.
Chuck S is offline   Reply With Quote
Old August 23rd, 2005, 06:25 PM   #3 (permalink)
Registered User
 
Join Date: Jan 2005
Posts: 9
thanks omegatron...

im confuse with this

$rel_dir = "/YOURPATH/gallery/data/"; // path to the data directory where pictures reside RELATIVE

what is the meaning of this? can you give me an idea about this one?

thanks
jalmz_lira_jull is offline   Reply With Quote
Old August 23rd, 2005, 07:27 PM   #4 (permalink)
Photopost Developer
Verified Customer
 
Chuck S's Avatar
 
Join Date: Jun 2002
Location: Abingdon,MD
Posts: 71,947
the server path to your data dir should be the same as your data path in photopost options
__________________
Photopost Developer and Support Engineer

Please do not PM me for support or sales questions. Thank you for your understanding.
Chuck S is offline   Reply With Quote
Old August 23rd, 2005, 09:42 PM   #5 (permalink)
Registered User
 
Join Date: Jan 2005
Posts: 9
thank

ahh ok.. thanks chuck, my hack is now working.. hehehe

more power!


Last edited by jalmz_lira_jull; August 23rd, 2005 at 09:52 PM.
jalmz_lira_jull is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 11:40 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0