guide for advance method

Update: The content in this post maybe out of date or inaccurate. Visit our Support Page

can u write me a guide how to use the advance method.. i have downlod the code sample but it seems doesnt work..

thanx in advance..

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

Hello xero and thanks for writing in Wink

There are instructions on the page where you download the advanced method code. Is there something specifically that is not working for you or you can provide an example of the problem??

There have been quite a few changes lately, and it is possible that my original code is broken as a result (though, I've not heard any other complaints). So, if you can provide examples, I would be more than happy to make sure my sample code doesn't need updating and then walk you through setting it up on your website.

Best regards,

Brandon

Anonymous

i dunno what wrong.. i just cant call the function.. so maybe can u gimme guide how to.. i use wordpress..

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

Hi xero,

Do you have a hosted wordpress blog (i.e. yourblog.wordpress.com)?
Or do you have your own hosting and host your own wordpress blog?

Please log in to STW and update your profile with your website.

The quick answer is:

1. You cannot use the API code on the hosted wordpress blog because they do not support uploading of PHP files.

2. It is much easier anyway to use the "simple method" of img src --which you can copy/paste from logging in to STW, clicking on 'Get Thumbnail Code', 'Simple Method' and the code will be provided for you. Just remember to replace your access information. Wink

Please update your profile and I will be happy to take a look!

Best regards,

Brandon

Anonymous

owh..sorry.. forgot to mention it.. i use self hosted wordpress..

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

In that case, it might have been a bug in the version of code you have.

Someone just pointed out recently a typo that would break the thumbnail link. I was surprised that no one pointed it out sooner but I guess they got it fixed and moved on.

However, that typo has been corrected, and you should download the latest version of the sample code to see if that was the problem:
http://www.shrinktheweb.com/shrinktheweb-plugins.htm

If you have modified the sample code a lot, you can simply search for:
{$thexists=1; $thumbnail = "<a href='#'><img src='"$homedir.$dom.".jpg' border='0' align='left'></a>";}

and replace with:
{$thexists=1; $thumbnail = "<a href='#'><img src='".$homedir.$dom.".jpg' border='0' align='left'></a>";}

If that isn't what caused your problem, then please let me know and I'll take a look.

By the way, I added one of your photos (drunk baby) to my stumbleupon profile... lol. That's too funny.

Cheers,

Brandon

Anonymous

Laughing out loud ok.. now let me ask the real noob question.. sorry for troubling u..

i've download the zip and i upload the sample api php.. edit the access key , i rename it to snap.php . the question is.. how do i generate the thumbnail?

use this : <?php shrinktheweb($size, $url); ?> ???

or if there have any step i skip just now?

it will be easier to use the simple method but i will run a web gallery soon.. on that page will preview many thumbnail.. so its will load quick if has caching system or store the thumbnail on localhost.. the advance method will be usefull i guess.. sorry again for troubling u.. appreciate ur help..

puravida's picture
puravida
Jedi Warrior
Offline
Joined: 09/01/2007
Visit puravida's Website
xero wrote:
Laughing out loud ok.. now let me ask the real noob question.. sorry for troubling u..

It's no trouble at all

Cotización:
i've download the zip and i upload the sample api php.. edit the access key , i rename it to snap.php . the question is.. how do i generate the thumbnail?

Just to be clear, there are two files in the download. One file (with all the access key, etc) is the function code that will cache the image for you in this case.

The other file (sample PHP code) goes inside the actual pages. So, unless you need to make some changes to that code, you would just copy the entire file (v1.0.0 is 28 lines)
into your page anywhere before you want to show the thumbnails. Then, you will call them like this:

<?php echo $thumbnail; ?>
That will only show one thumbnail, though, so you will most likely want to put that "echo $thumbnail;" inside of a loop of some kind and replace $dom with the URL each loop.

Note: The example code puts a link on the image (goes to '#') just to show that you CAN do that. If you don't want a link, then remove the ... or if you want to use it, then put in some variable there like $dom (that would go to the website) instead of #.

Cotización:
it will be easier to use the simple method but i will run a web gallery soon.. on that page will preview many thumbnail.. so its will load quick if has caching system or store the thumbnail on localhost.. the advance method will be usefull i guess..

Got it. That is a good idea to help speed things up on your side. You just need to occasionally delete the cached versions so that you will download the new ones. This is simple with a monthly cron that deletes (and/or backs up) your image cache directory.

I will probably write a quick sample for this at some point and make it avaiable.

I hope that helps you get going but if you run into trouble, please DO ask... It is in everyone's best interest to make sure we can get it working for you and anyone else who has trouble. I was rushed to put that together and I'm sure the process and explanation needs to be refined a bit.

Best regards,

Brandon

Anonymous

hello brandon,

in stw-sample-PHP-code_v1-0-0.php on line 7

$homedir="[homedir]"; // Replace [homedir] with the path to store thumbnails (i.e. /home/username/public_html/cached/images/)

i replace the [homedir] with /home/username/public_html/cached/images/ its appears the image url like : http://domain.com/path/home/username/public_html/cached/images/ . i guess the [homedir] must be replace with http://domain/path/cached/images/

Cotización:
Just to be clear, there are two files in the download. One file (with all the access key, etc) is the function code that will cache the image for you in this case.

The other file (sample PHP code) goes inside the actual pages. So, unless you need to make some changes to that code, you would just copy the entire file (v1.0.0 is 28 lines)
into your page anywhere before you want to show the thumbnails. Then, you will call them like this:

Code:
<?php echo $thumbnail; ?>

That will only show one thumbnail, though, so you will most likely want to put that "echo $thumbnail;" inside of a loop of some kind and replace $dom with the URL each loop.

Laughing out loud sorry... i dont get the last part that replace the $dom.. ???.. if im correct the code must be like this ? :

<?php include('stw-api-functions-PHP_v1-0-1.php'); ?>
<?php include ('stw-sample-PHP-code_v1-0-0.php'); ?>

<?php echo $thumbnail; ?>

but that just show the default image : nothumb.jpg ...

a quick question, the code i download will functioning like

http://www.shrinktheweb.com/xino.php?embed=1&stwu=[secret access]&STWAccessKeyId=[access key id]&Size=sm&stwUrl=yoursite

eg: http://domain.com/stw.php?url=yoursite

am i right? or not.. huhu.. sorry again for troubling u.. haah.. i mess up with this..

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

The problem with "including" the stw-sample-PHP-code_v1-0-0.php file into your other pages is that you cannot customize the $dom variable -which I think is where some of the confusion is coming in.

Inside the sample code, you must loop or pass the $dom variable in some way --such as:
$dom = yahoo.com;

Otherwise, it will try to retrieve the url of http://$dom --which will fail, of course and then it will return nothumb.jpg --as you see. So, basically, I would copy the contents of stw-sample-PHP-code_v1-0-0.php (between the PHP start-end tags) into the page itself. That way, you have more control. Once you get it working that way, you can experiment with including or more advanced techniques. I haven't worked with that code in awhile, so I cannot think of a better way to do it than that for starters.

Cotización:
i replace the [homedir] with /home/username/public_html/cached/images/ its appears the image url like : http://domain.com/path/home/username/public_html/cached/images/ . i guess the [homedir] must be replace with http://domain/path/cached/images/

First I should note that you need to replace "username" in that path to the username of your hosting account. So, if you hosting control panel login is xero, it would look like:

$homedir="/home/xero/public_html/cached/images/";
That is the correct way to do it. I'm not sure why it is showing up as http://domain.com/path/home/etc....

I should ask: Is this a windows box or a linux box?

Sorry this is not going as smoothly as it should but thank you for working through this with me. Working through the process and these kinds of issues is exactly why it is good to have a BETA stage. Wink

-Brandon

Anonymous

yay.. atlast i got it work.. thanx brandon.. Laughing out loud

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.