PLEASE NOTE: This article may be out-of-date. Please visit the Support site for the latest information.

Using PagePix (Website Previews) with vBulletin

13 posts / 0 new
Last post
Anonymous

Hello,

Just found your service and must say I am impressed with it and thrilled that you offer an API and excited to get this working with vBulletin.

Please note I am not a programmer, so I do need assistance.

What I want is to get this to grab website thumbnails for my members homepage, this is only viewed on their profile page, see mine for instance: http://www.webtalkforums.com/member.php?u=1

For now, I just stuck your simple method in there, but I want to use the advanced method so we can cache these thumbnails, which we will delete monthly or so via cron as you suggested in another thread.

Here's what the link grabbing the images currently looks like:
http://www.shrinktheweb.com/xino.php?embed=1&Size=lg&stwUrl=$userinfo[homepage]

This is vbulletin's code to grab the members homepage url which they add in their profile.
$userinfo[homepage]

My full code is like so:
<a href="$userinfo[homepage]" target="_blank"><img src="http://www.shrinktheweb.com/xino.php?embed=1&Size=lg&stwUrl=$userinfo[homepage]" width="125" height="125" border="0" style="border: 3px double #aacbec" alt="$userinfo[username]'s Homepage" /></a>

This is done in the MEMBERINFO template, so I cannot stick your PHP code in there, with vbulletin, any PHP code has to be inserted via vbulletin's plugin system where we can make use of hooks.

I don't know where to start but I've downloaded your code, I just don't know what to do with it or how to link to it or request images based on the vbulletin code: $userinfo[homepage]

Thanks for your time. Smile

Anonymous

So far what I did was create a plugin in vbulletin using the hook location "member_complete", this is for the member's profile page.

I then took the php code from both .php files you gave us to download and put that code into the plugin, I then added the $thumbnail variable to my MEMBERINFO template.

So far it's showing the default_image only. Now I just have to figure out how to get it to read what $userinfo[homepage] is....

puravida's picture
puravida
Jedi Warrior
Offline
Joined: 09/01/2007
Visit puravida's Website

Hi Kalina,

Glad you found our service and like it! Smile

Sorry for the delay but I've been at a business expo all day today and just got back. Now, I have to run out for a dinner meeting.

I will take a look at what you've done when I return. I know that running PHP code in my Invision Pro Board (IPB) forum took a bit of creative coding, but I haven't yet tried it on vBulletin.

However, I do have a vBulletin forum as well and can test with that, if necessary. So, I will check into when I return later tonight and will post here again once I know something.

Cheers,

Brandon

puravida's picture
puravida
Jedi Warrior
Offline
Joined: 09/01/2007
Visit puravida's Website

Actually, I just checked and it seems that it is working -at least for the few users I tested. Did you figure it out yourself already?? Smile

I noticed you are stretching the image to 125x125 and it looks a little funny. You probably just want to remove the width and height tags altogether and let the browser size accordingly or else put the default of width=200 and height=150 (for Size=lg).

Cheers,

Brandon

Anonymous

Hi Brandon,

I didn't figure it out yet. I am using the normal code on the site you're referring to. I was testing on a testing forum earlier so you didn't actually see the results of it.

If you figure it out, please let me know as I'd prefer to cache it then link directly.

I am ok with it being 125x125, looks fine to me.

puravida's picture
puravida
Jedi Warrior
Offline
Joined: 09/01/2007
Visit puravida's Website

Hi Kalina,

I took a look at my vBulletin and the template modifications are a little more in-depth than I can cover right now.

However, I found a very helpful article that should point you in the right direction:
http://www.vbulletin.com/forum/showthread.php?t=173937

They basically show you how to create a "plugin" and then use a "hook" to call that variable in the MEMBERINFO part of the template. That way, you can include and execute PHP code right there before the "Home Page:" link.

Sorry that I cannot spend more time and make the plugin for you. I would love to, but I'm trying to get ready for our "Go Live" launch date and release the new "Specific Page" feature for BETA testing all at the same time. Both of those are quite an undertaking. I hope you understand.

Best regards,

Brandon

puravida's picture
puravida
Jedi Warrior
Offline
Joined: 09/01/2007
Visit puravida's Website

As a follow-up note, the file to include in this manner is the sample code and inside of the sample code should be an include for the api functions.

It looks fairly simple except for my big question of how to pass the $URL into the included PHP file. Perhaps they answered that in the tutorial but I may have overlooked it.

-Brandon

Anonymous

Brandon,

Not sure how much of my original posts you read, but I already did the stuff you say that vbulletin.com page mentions, I already knew how and explained everything I've done thus far.

I won't be able to work on this for awhile, I am booked with projects, if I ever get it figured out I'll post here. Smile

Colleen

puravida's picture
puravida
Jedi Warrior
Offline
Joined: 09/01/2007
Visit puravida's Website

Ah, you're right. I read your original post a few days back but it didn't sink in... it's been a loooooooong week. Wink

Now that I've re-read your post, I see that I just echoed your thoughts.

I had to take a quick power nap and decided to lucid dream this problem and my first thought is that they do not seem to have the plugins set up to be "dynamic" -which we need- so I was dreaming about how to do that.

I think we can do that by passing the variable when including the file. See below. Their default code:

ob_start();
   include('path/to/this/file/myfile.php');
   $includedphp = ob_get_contents();
ob_end_clean();

versus

ob_start();
   include('path/to/this/file/shrinkweb.php?domain=$userinfo[homepage]');
   $includedphp = ob_get_contents();
ob_end_clean();

I just named the sample code "shrinkweb.php" in my example and it would need to -in turn- include the API function code. If we pass the domain var when including, we might get lucky enough that it makes it into the script at run-time and then further passed on to the included API functions. If so, the API function should return the proper URL and the shrinkweb.php file should return the proper thumbnail as $thumbnail. In a perfect world, that would work. However, it will probably require some testing and creativity.

My devil's advocate argument on this solution is that you cannot pass a variable when including. If that's the case, I suppose we would need an answer from vBulletin how they expect us to pass a variable into the included PHP file.

IF that worked as-is, your code in the MEMBERINFO page would be changed slightly to look like this:
<a href="$userinfo[homepage]" target="_blank">$thumbnail</a>
The specific CSS style you want would be hard-coded into the included shrinkweb.php file.

That all sounds a lot more complex than it ought to, but it should work. Sorry that I do not have time to test it and give you a definite answer. Sad

Best regards,

Brandon

puravida's picture
puravida
Jedi Warrior
Offline
Joined: 09/01/2007
Visit puravida's Website

I forgot to also mention that your "hook" could be specific to the MEMBERINFO page or be global --either way-- as long as we have the $userinfo[homepage] var when viewing that MEMBERINFO page.

puravida's picture
puravida
Jedi Warrior
Offline
Joined: 09/01/2007
Visit puravida's Website

Quick update:

I researched a bit on the web to see the viability of my solution and it probably won't work and isn't necessary. This is because I saw statements about PHP that the include will include it there as if it were written right in-line on the page it was called.

So, that says to me that we should be able to put:
$domain=$userinfo[homepage];

right at the top of the sample file when we include it and it should have access to the $userinfo[homepage] var at that point. Hopefully it works that way. It's worth a try. Wink

If it worked, then you would use the $thumbnail var in the way I mentioned previously.

-Brandon

Topic locked

ShrinkTheWeb® (About STW) is another innovation by Neosys Consulting

Contact Us | PagePix Benefits | Learn More | Our Partners | Privacy Policy | Terms of Use

©2014 ShrinkTheWeb. All rights reserved. ShrinkTheWeb is a registered trademark of ShrinkTheWeb.