vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   vBulletin CMS Widgets - Photopost Pro Random Image Widget (https://vborg.vbsupport.ru/showthread.php?t=234589)

lovevn 02-10-2010 11:13 AM

Problem fixed!
works ok

ZippySLC 02-10-2010 11:52 AM

Quote:

Originally Posted by lovevn (Post 1979019)
I tried it but the result is jut a time in formation. 10/02/2010. No image. How to solve the problem?

PM me the URL to your site and your code please.

HRCHOSTING 02-10-2010 09:48 PM

Entered the code but all I see is "see more photo's in our Gallery"

ZippySLC 02-10-2010 10:30 PM

Yeah, there's a problem with the code or the path to your gallery. If you send me a copy of your code (with the database info redacted) and a link to your CMS and gallery, I'll take a look.

HRCHOSTING 02-14-2010 02:29 PM

Working great now, thanks for the help!

ZippySLC 02-14-2010 03:45 PM

Glad I could help!

LCN2007 02-23-2010 05:47 PM

Any way to show more than one image like maybe 3 or 5 images?


Quote:

Originally Posted by Bergler (Post 1971797)
Now that I am playing around with it a bit, I see it doesnt always show a picture?

X2 on this issue, any fix?

ZippySLC 02-24-2010 02:16 AM

Quote:

Originally Posted by LCN2007 (Post 1989806)
Any way to show more than one image like maybe 3 or 5 images?

The way the code is written, it just does one SQL query and grabs one picture out of the database. To get it to do any more would require the entire thing to be re-written. I didn't write the code to grab the pic from the db or display it, I just adjusted it so it would play nice as a CMS widget.

Quote:

X2 on this issue, any fix?
So what is happening here is the code is selecting an image that your Photopost database thinks is there, but it isn't. If you look at the thread on Photopost's site you'll see people having the same problem there too.

theduyet 02-27-2010 06:50 AM

Quote:

Originally Posted by tazattitude (Post 1971129)
Actually, there is a file that you can download from Photopost, and re-upload in your "Gallery". Then you run it from your Gallery cp. This will create a "product" file that you upload in your vb products section.
This will create a thumbnail strip that you can specify weather you want newest or newest pics. Plus the amount of images you want to show up.
You can make the changes in the Plugin section.
You can see how I have 6 images are 'random' on my website


This of course, if it's Photopost Gallery

Would you like to attach this file into this thread?
I and serveral VB.ORg members really like to get it.
Thank you!

tazattitude 02-27-2010 09:29 AM

Quote:

Originally Posted by theduyet (Post 1992622)
Would you like to attach this file into this thread?
I and serveral VB.ORg members really like to get it.
Thank you!

Here would be the link and info to it
Keep in mind this is not a widget like ZippySLC's

theduyet 02-27-2010 12:12 PM

I can't download.
Would you like to attach it in vbulletin.org ?

theduyet 03-06-2010 03:45 AM

help me :(

ZippySLC 03-06-2010 10:04 AM

It's right there in the thread that Taz linked to.

tazattitude 03-06-2010 11:07 AM

Quote:

Originally Posted by theduyet (Post 1998189)
help me :(

Not for sure what you need help with. The link, instructions, download are all there (thanks Zippy). Of course, you'll have to own a Photopost to do this.

Again, this is not the exact same thing that Zippy has done.

molieman 03-06-2010 12:04 PM

Can this be used with PhotoPost "Classifieds?"

Fantastic job, looks great. :) Thank you. :)

molieman 03-06-2010 02:38 PM

This is probably a simple error in my part, but would appreciate some advise to correct this :)

I get this error after installing the widget on the home page:

Table '*****_****simvb4.pp_photos' doesn't exist
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
===============================================
Disregard above, figured that one out :)

Now I don't have a photos showing. Here is my code, what did I do wrong. Photopost is in the root public_html/photopost and my forum (vB) is here public_html/forums/

If I right click on empty image and select show image in new tab, I get "Photo not found in the database!"

PHP Code:

ob_start(); 

$result mysql_query("SELECT id,cat,bigimage FROM pp_photos order by rand() LIMIT 1" ) or die(mysql_error());    
while(
$row mysql_fetch_array$result )) {     
print 
"<div align=\"center\"><a href=\"photopost/showphoto.php/photo/" $row['id'] . "\"><img src=\"photopost/data/" $row['cat'] . "/thumbs/" .  $row['bigimage'] . "\"></a><br /><a href=\"/photopost\">See more photos in the Gallery</a></div>"



Heldenverband 03-11-2010 06:41 AM

Anybody use this in VBCMS ( vbdesigns.de ) ? I am searching for a similar module to show random images on VBCMS portal.

molieman 03-11-2010 10:24 AM

I'm assuming this mod/widget is dead? I couldn't get it to work :( Looks great on the demo.... but that doesn't help me :(

phkk 03-11-2010 03:09 PM

Finished all steps but no output.

Heldenverband 03-11-2010 03:58 PM

At the moment we try to solve this on a module in VBCMS ( vbdesigns.de )

phkk 03-11-2010 04:47 PM

how can i let the output appear on new winprint "<div align=\"center\"><a href=\"photos/showphoto.php/photo/" . $row['id'] . "\"><img src=\"photos/data/" . $row['cat'] . "/thumbs/" . $row['bigimage'] . "\"></a><br /><a href=\"/gallery\">See more photos in the Gallery</a></div>"; dows, new frame.

ZGeek 03-12-2010 12:45 AM

Just in case anyone needs it. I've modified the query to exclude a category I have for NSFW images. This was based on help from the photopost forums. Thought I would share.

Change
Code:

$result = mysql_query("SELECT id,cat,bigimage FROM pp_photos order by rand() LIMIT 1" ) or die(mysql_error());
to
Code:

$result = mysql_query("SELECT id,cat,bigimage FROM pp_photos WHERE approved=1 AND cat NOT IN (502) order by rand() LIMIT 1" ) or die(mysql_error());
Just change the 502 to the category number you want to exclude. You should be able to add extra categories by adding numbers like so (502,503,504,505). But I am a n00b with php so I could be wrong.

wampforum 03-13-2010 06:22 AM

hmm couldnt get this to show an actual picture - just the 'more pictures in the gallery' (the link of which worked ok)
shame

Wild Bronco 03-27-2010 07:45 PM

I have 4 images in a horizontal line

Is it possible to show images in vertical line rather than horizontal?

Wild Bronco 03-28-2010 08:17 PM

I have tried to change the div align code

and a few other things but I can't find the right way.

Heldenverband 03-29-2010 07:25 AM

It works as VBCMS Modul at HERE

antboy 04-11-2010 03:10 AM

ZippySLC - thanks for such a nice little hack works as described no problems

couple of things

1) i have found that i can increase the number of images shown by changing LIMIT to a higher number

this is great but i would love to have the images shown horizontally - is this possible ??

2) i also tried changing the order from random to date but strangely it showed it in the reverse order with the oldest images in the database showing first -

regards and thnx again Anthony

msolano 11-03-2010 08:11 PM

If you are usign SEO in "Spider-Friendly URL's" you have to change the Select and the href code:

Code:

SELECT p.id,p.user,p.userid,p.cat,p.bigimage,p.title,c.catname,c.photos,c.posts
FROM pp_photos p LEFT JOIN pp_categories c ON c.id = p.cat
WHERE p.storecat = 0
AND p.cat NOT IN (500)
ORDER BY RAND()
LIMIT 1

And the href:

Code:

print "<div align=\"center\">
<a href=\"gallery_url/g" . $row['cat'] . "-" . $row['catname'] . ".html\">
<img  ...

I'm not php programmer but I know about programming :) and I used the code from vb profile integration published in photopost official site.

It works in my site about aquariums

pankaj1980 11-23-2010 05:47 AM

Hi,

I am a newbie and want to use your widget. I have followed the steps as mentioned by you but i don't have Photopost tables. From where i can get this tables. Please help me on this.

Regards,
Pankaj

tattooz 01-08-2011 08:27 PM

I was messing around with this code today and was able to get the widget to show HORIZONTALLY. Here is what I got and if you want to see it in action, visit http://www.modificationnation.com/ and under the big banner in the center you will see random members then FRESH INK & MODS.

You will need to add your database info at the top and change DOMAIN.COM to your URL. It should work no matter what your seo url's are set to but I don't know for sure. I have it set up to pull the newest photos from the gallery. If you would like it to pull random simply change "order by id DESC" to "order by rand()"

I am no coder, so I will do my absolute best to help you if it doesn't work

Code:

$host  = 'localhost';
$dbUser = 'DATABASE USER'; 
$dbPass = 'DATABASE PASSWORD';
$db = 'DATABASE NAME';
mysql_connect("$host", "$dbUser", "$dbPass") or die(mysql_error());
mysql_select_db("$db") or die(mysql_error());

ob_start();

$result = mysql_query("SELECT id,cat,bigimage FROM pp_photos order by id DESC LIMIT 8") or die(mysql_error());
print "<table align=\"center\" border=\"3\" bordercolor=\"black\" cellpadding=\"10\"><tr>"; 
while($row = mysql_fetch_array( $result )) {   
print "<td><div align=\"center\"><a href=\"http://DOMAIN.COM/showphoto.php/photo/" . $row['id'] . "\"><img src=\"http://DOMAIN.COM/data/" . $row['cat'] . "/thumbs/" .  $row['bigimage'] . "\" width=\"100px\" height=\"100px\"></a></div></td>";
}

print "</tr></table>";
$output .= ob_get_contents();
ob_end_clean();


rosebudtr 03-22-2011 06:22 PM

<a href="http://www.dizilerimizden.com" target="_blank">www.dizilerimizden.com</a> . i added my cms

stl7997 04-03-2011 07:12 PM

Works for me, thanks for this!

http://www.aerovacworld.com (left side of page)

sjm14 07-14-2011 09:57 AM

Great! but I cannot get it to work I've installed it but I'm getting this message

Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'database_server' (1) in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 6

Can you point me in the right direction please, Dummies guide;-)

8thos 07-25-2011 06:52 AM

Interesting.

bpi007 07-25-2011 07:02 AM

Quote:

Originally Posted by sjm14 (Post 2220374)
Great! but I cannot get it to work I've installed it but I'm getting this message

Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'database_server' (1) in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 6

Can you point me in the right direction please, Dummies guide;-)

Have you change something in :

Code:

$host  = 'localhost';
If yes, try like original post.

tommyxv 08-16-2011 03:11 AM

isn't there a way to reference (require once or include) a custom php file that can store the database and password info instead of putting it into the widget itself? Don't want all admins to have that info.

glaive 04-18-2012 02:24 PM

Here's an update to this code using vb db class type stuff I learned from migrating another project from vb 3.8x to v4.x. Now the "dangerous" db connection stuff is not available to any who read the code.

My version comments out two query executions you will need if your photopost db is different than your vb db.

I have also tweaked the query to fix an issue where the storage cat was different than the cat field and not 0 ( meaning catstore was not used.

My code builds on 9 random images in a simple table.

Note that I pull the cat out as cat_real and not just cat anymore.

I give this code freely to the original author and the community. I will try to mind the thread to help people and/or the OP. Thank you ZippySLC for getting my brain rolling on this.

You can see my version working here.

PHP Code:

ob_start();

// If your photo_post is not in the vbulletin db
//$sql_pp_db="USE Replace_with_PhotoPost_DB_name";
//$GLOBALS["vbulletin"]->db->query_read($sql_pp_db);

$sql_rp = <<<SQL
  SELECT
    id,
    if(
      storecat = 0,
      cat,
      if(
        cat != storecat,
        storecat,
        cat
      )
    ) as cat_real,
    bigimage
  FROM
    pp_photos
  ORDER BY rand()
  LIMIT 9
SQL;

$result_rp $GLOBALS["vbulletin"]->db->query_read($sql_rp);

echo 
"<center>";
echo 
"<table>";
$x 0;
while((
$array_rp $GLOBALS["vbulletin"]->db->fetch_array($result_rp)))
{
  if( 
$x == )
  {
    echo 
"<tr>";
  }
  elseif( 
$x == )
  {
    echo 
"</tr><tr>";
  }
  echo 
"<td>";
  echo 
"<a href=\"/gallery/showphoto.php/photo/" $array_rp["id"] . "\">";
  echo 
"<img src=\"/gallery/data/" $array_rp["cat_real"] . "/thumbs/" .  $array_rp["bigimage"] . "\" />";
  echo 
"</a></td>\n";
  
$x++;
}
 echo 
"</tr></table><br /><a href=\"/gallery\">See more photos in the Gallery</a></center>\n";

// If your photo_post is not in the vbulletin db
//$sql_pp_db="USE Replace_with_vbulletin_DB_name";
//$GLOBALS["vbulletin"]->db->query_read($sql_pp_db);

$output .= ob_get_contents();
ob_end_clean(); 


Magnusson2u 05-22-2012 01:52 AM

Quote:

Photopost tables don't have the pp_ prefix, you'll need to alter the code to reflect your prefix.
Hi,

How/where would I place/define this?

PHP Code:

$result+=+mysql_query("SELECT+id,cat,bigimage+FROM+pp_photos+order+by+rand()+LIMIT+1"+)+or+die(mysql_error());+++ 
while(
$row+=+mysql_fetch_array(+$result+))+ 

Do I replace "pp_photos" with the name of my database?

Thanks in advance...

BGObsession 01-25-2014 11:28 PM

Quote:

Originally Posted by glaive (Post 2321297)
Here's an update to this code using vb db class type stuff I learned from migrating another project from vb 3.8x to v4.x. Now the "dangerous" db connection stuff is not available to any who read the code.

My version comments out two query executions you will need if your photopost db is different than your vb db.

I have also tweaked the query to fix an issue where the storage cat was different than the cat field and not 0 ( meaning catstore was not used.

My code builds on 9 random images in a simple table.

Note that I pull the cat out as cat_real and not just cat anymore.

I give this code freely to the original author and the community. I will try to mind the thread to help people and/or the OP. Thank you ZippySLC for getting my brain rolling on this.

You can see my version working here.

PHP Code:

ob_start();

// If your photo_post is not in the vbulletin db
//$sql_pp_db="USE Replace_with_PhotoPost_DB_name";
//$GLOBALS["vbulletin"]->db->query_read($sql_pp_db);

$sql_rp = <<<SQL
  SELECT
    id,
    if(
      storecat = 0,
      cat,
      if(
        cat != storecat,
        storecat,
        cat
      )
    ) as cat_real,
    bigimage
  FROM
    pp_photos
  ORDER BY rand()
  LIMIT 9
SQL;

$result_rp $GLOBALS["vbulletin"]->db->query_read($sql_rp);

echo 
"<center>";
echo 
"<table>";
$x 0;
while((
$array_rp $GLOBALS["vbulletin"]->db->fetch_array($result_rp)))
{
  if( 
$x == )
  {
    echo 
"<tr>";
  }
  elseif( 
$x == )
  {
    echo 
"</tr><tr>";
  }
  echo 
"<td>";
  echo 
"<a href=\"/gallery/showphoto.php/photo/" $array_rp["id"] . "\">";
  echo 
"<img src=\"/gallery/data/" $array_rp["cat_real"] . "/thumbs/" .  $array_rp["bigimage"] . "\" />";
  echo 
"</a></td>\n";
  
$x++;
}
 echo 
"</tr></table><br /><a href=\"/gallery\">See more photos in the Gallery</a></center>\n";

// If your photo_post is not in the vbulletin db
//$sql_pp_db="USE Replace_with_vbulletin_DB_name";
//$GLOBALS["vbulletin"]->db->query_read($sql_pp_db);

$output .= ob_get_contents();
ob_end_clean(); 


This is working great for me. If anyone wants to see it in action, you can see it in my left CMS column at http://www.bgobsession.com/content/

I changed the '9' to '1' as I want just a single random photo showing. Only questions I have are, does the photo change daily or should it be changing with every screen refresh (I expected it to change with every screen refresh but that doesn't seem to be the case). Also - is it possible to make the pulled image a little bigger or define the default width and height (the pulled image is smaller than I'd like for that widget)?


All times are GMT. The time now is 02:49 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01325 seconds
  • Memory Usage 1,866KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (4)bbcode_php_printable
  • (10)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (39)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete