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

PRO: Specific Page Captures (i.e. inside pages)

18 posts / 0 new
Last post
puravida's picture
puravida
Jedi Warrior
Online
Joined: 09/01/2007
Visit puravida's Website

I have finally gotten the specific page captures overhaul completed. It is now available in BETA testing for those of you who are eager to try it out.

Please note that this new feature required a VERY hefty overhaul to my code, so -as always- please keep me informed of any oddities you encounter. I thoroughly tested everything, but bugs can always slip through. Wink

Now, for the details:

This feature will allow you to capture a specific page on a website. For instance, a specific page URL to capture would look like:

http://www.imagion.com/web_design.htm

I also added support to allow for capture of dynamic URLs! I do not believe anyone else supports that ability and -believe me- it wasn't easy to get working! lol. A dynamic page is something like:

http://www.get-paid-hwy.com/index.php?showforum=51

I even wrote in support ('cause I knew you'd ask! hah) to allow you to capture custom-sizes and full-length thumbnails of specific pages. So, I think your options are nearly limitless now.

Usage Information

Ok, so to take advantage of this feature is fairly simple and straightforward. If you just want a standard capture (i.e. default size), you simply put the entire Url in your request and you add:
&inside=1
somewhere in the URL. An example could look like:

http://www.shrinktheweb.com/xino.php?embed=1&stwu=&STWAccessKeyId=&inside=1&Size=lg&stwUrl=http://www.get-paid-hwy.com/index.php?showforum=51

*My auth information was removed, but you can put yours in and copy/paste into a browser, if you want to test it.

Note: Do NOT put these variables after the &stwUrl= portion of your request or else the captured page will NOT be correct!

Now, to capture specific pages in full or custom-sizes, you just use:
&inside=1
in conjunction with the appropriate variable:
&full=1&scale=10
*for full-length
&xmax=120
*for a custom size

I welcome any and all feedback (good or bad) on this powerful new feature and look forward to seeing some creative applications!

Enjoy!

Brandon
-

GloTouch
Offline
Joined: 04/13/2008
Visit GloTouch's Website

Finally what I've been waiting for! Cool

However, I'm having a problem with the advanced method. My script works fine until I add &inside=1. Here is the code I'm using to request the image:

	
$request_url =  "http://www.shrinktheweb.com/xino.php?"
					. "Service=".           "ShrinkWebUrlThumbnail"
					. "&Action=".           "Thumbnail"
					. "&STWAccessKeyId=".   $access_key_id
					. "&inside=".		"1"
					. "&xmax=".			"100"
					. "&stwu=" .			$secret_access_key
					. "&stwUrl=" .             $url;

This code fails to generate an image on my server, but without the &inside=1 it will work fine. Any idea what I'm doing wrong? I havn't looked at the rest of the code yet, but it looks like that is the only thing that should need changed.

On a side note, I tried changing around the advanced method to create a gif file instead of jpeg. It did not work. Is this because shrinktheweb returns the image file in a jpeg format already, or did I mess up on the coding?

UPDATE: Ah, I just went into my account history and noticed that the thumbnails are being generated, but not storing on the server properly. I'll look a bit more into the code, and hopefully will resolve this so you don't have to!

puravida's picture
puravida
Jedi Warrior
Online
Joined: 09/01/2007
Visit puravida's Website
GloTouch wrote:
UPDATE: Ah, I just went into my account history and noticed that the thumbnails are being generated, but not storing on the server properly. I'll look a bit more into the code, and hopefully will resolve this so you don't have to!

Yeah, just let me know what you find on that as you progress. I HAD to get some sleep, so I didn't test it for the API because it should be as simple as adding that line for inside=1 (just like you did). But, there could always be some little nuance to getting it to work.

Quote:
On a side note, I tried changing around the advanced method to create a gif file instead of jpeg. It did not work. Is this because shrinktheweb returns the image file in a jpeg format already, or did I mess up on the coding?

Yes, you are correct in that we return the image as a jpeg already. This is necessary so that the browser will interpret the data and allow a user to save an image right out of the browser. You may have seen before where it was not sent as a jpeg but that limits its usefulness to the end-user. So, we changed it to the expected behavior.

In thinking about it a little more, you might try caching the jpeg and then converting to gif. Perhaps that would work. It might even be ok to do that on-the-fly, if the thumbnail already exists.

Brandon

GloTouch
Offline
Joined: 04/13/2008
Visit GloTouch's Website

Like I said before, it works perfectly fine without the inside=1 so I'm not sure what would be causing this. It may have something to do with the XML that the server is returning.

If this helps, I did a var dump on exists and thumbnails before it calls the get_html_snippet function. Exists returned false and thumbnails returned http://www.shrinktheweb.com/images/nothumb-sm.jpg.

I also did a var dump without the inside=1. Exists returned true and thunbmails returned http://www.shrinktheweb.com/thumbs/d89g83938jfowic8/www.glotouch.com-sm.jpg. So, I'm guessing there is something wrong with this code:

	$num_matches = preg_match('/<[^:]*:Thumbnail\\s*(?:Exists=\"((?:true)|(?:false))\")?[^>]*>([^<]*)<\//', $line, $matches);
	if($num_matches == 1){
		$exists = $matches[1];
		$thumbnail = $matches[2];
	}else{
		$exists = NULL;
		$thumbnail = NULL;
	}

Perhaps you might know whats wrong now.

I'm still trying to figure out how this code works though. The only thing I'm trying to use it for is to save the thumbnails on my server when one is requested. So if the thumbnail is queued up...the default image is displayed. But then how would it save it to the server? I only run this code once when a user creates a new theme. Hopefully this makes sense to you, but my question is this: If an image is queued up and not available instantly when running this code, how does it update itself? Do I need to run this code again? Perhaps this is my problem...The thumbnails are getting a slight queue and therefore returning a no image exsists and not storing anything.

After thinking about it a bit more, the API returns a html img tag with the picture is this correct? I have been using it to only create an image which has worked until this point because there were no queue times. So to properly use this code, I should place the function call where I want my image tag to be located?

puravida's picture
puravida
Jedi Warrior
Online
Joined: 09/01/2007
Visit puravida's Website
GloTouch wrote:
Like I said before, it works perfectly fine without the inside=1 so I'm not sure what would be causing this. It may have something to do with the XML that the server is returning.

There "could" be a problem with the XML that is returning but now that I think about it, I did test this last night. I remember that I made some modifications to that code and needed to know that I didn't break it. So, it did work for me in my tests.

Quote:
I only run this code once when a user creates a new theme. Hopefully this makes sense to you, but my question is this: If an image is queued up and not available instantly when running this code, how does it update itself? Do I need to run this code again? Perhaps this is my problem...The thumbnails are getting a slight queue and therefore returning a no image exsists and not storing anything.

I think you've hit the nail on the head here. If its queued (which is likely in the case of a specific page), then it won't store the image (cause you don't want to store the "Queued" image). So, you would have to call it again at some point to display the thumbnail.

Unfortunately, specific pages are not likely to be pre-fetched, so if you're wanting to show them instantly on the first call, you may have to re-think that. There is no way to make that instant and you don't want to put a timed delay in there because it's an unnecessary wait that still might return a Queued image if the queue ever gets really backed up.- as I'm sure will happen occasionally (i.e. when someone queues 12,000+ at once).

Quote:
After thinking about it a bit more, the API returns a html img tag with the picture is this correct? I have been using it to only create an image which has worked until this point because there were no queue times. So to properly use this code, I should place the function call where I want my image tag to be located?

Sorry but you kinda lost me on this thought... can you clarify?? or, did my previous answer cover this??

-Brandon

GloTouch
Offline
Joined: 04/13/2008
Visit GloTouch's Website
Quote:
Sorry but you kinda lost me on this thought... can you clarify?? or, did my previous answer cover this??

I'll I meant is that I did not realize the function returned anything. I've been using the API only to create an image on the server...This will solve all the problems I've been having by using the API as it was intended.

Thanks for the clarification on everything, I should be able to get it working when I get home.

Yup works perfectly! Thanks again, it looks great.

puravida's picture
puravida
Jedi Warrior
Online
Joined: 09/01/2007
Visit puravida's Website
GloTouch wrote:
Yup works perfectly! Thanks again, it looks great.

Awesome! Glad to hear it Smile

bbrian017
Offline
Joined: 10/29/2008
Visit bbrian017's Website

Hi,

I have tried to put this &inside=1 tag into my current URL, it work on my affiliate link but for the rest of the link, they didn't work. If I get rid of this inside=1, the rest of the links work fine but the affiliate link didn't. What should I do to make it work on affiliate link?

ps: I am currently using phpLD 3.3 script for my directory. Thanks

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

Hello,

Can you provide some examples, please?

I noticed a couple of your affiliate link captures were broken from last night's testing of our new thumbnail generators we brought online. So, I fixed those few for you but overall, there shouldn't be any issues.

I also want to check to see "where" you placed the &inside=1 and see if that might be causing a problem. I have seen some people putting the &inside=1 on the &stwUrl= variable -which could break the end result. For best results, the format of the url for specific pages should be:
http://www.shrinktheweb.com/xino.php?embed=1&stwu=USR&STWAccessKeyId=KEY&inside=1&Size=lg&stwUrl=http://test.com
versus a technically incorrect version of:
http://www.shrinktheweb.com/xino.php?embed=1&stwu=USR&STWAccessKeyId=KEY&Size=lg&stwUrl=http://test.com&inside=1

Does that help?

-Brandon

bbrian017
Offline
Joined: 10/29/2008
Visit bbrian017's Website

Hi brandon,

thanks for prompt reply. Yes this is what I have done. You can see the outcome in my site now (www.moneysearch4u.co.uk), what happen most affiliate link displayed ok, but all other non-affiliate links still waiting/queued. I tried that last night, wait until this morning, but they are all the same and uploading at all. What might be the problem? or I just need to wait until it display. Thanks

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

No, the queue has been clear for most of the night. So, if they are showing as queued, then there is some problem.

I checked your directory earlier but didn't see anything. I will try again to find some broken thumbnails.

-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.