i know this is a bit of a weird question but its a real time saver
so if you got any ideas (even partial) i would really apreacate them 🙂
Ok… so i am using wordpress built in interface to capture and disply
remote website images… here is the shortcode i am using..
/*********************************************************************
** SNAPSHOTS
*********************************************************************/
function wpr_snap($atts, $content = null) {
extract(shortcode_atts(array(
"snap" => 'http://s.wordpress.com/mshots/v1/',
"url" => 'http://www.sagive.co.il',
"alt" => 'My image',
"w" => '400', // width
"h" => '300' // height
), $atts));
$img = '<img src="' . $snap . '' . urlencode($url) . '?w=' . $w . '&h=' . $h . '" alt="' . $alt . '"/>';
return $img;
}
add_shortcode("snap", "wpr_snap");
(How to use this: https://wordpress.stackexchange.com/a/38293/7990)
.
thats easy no problem.. but – what if i want to integrate it with lightbox.. since its not an image hosted on my website is ther any way to access that images or even write somthing that would upload the image and make it the feautred image of that specific post (a strech i know) or maybe store it elsewhere somehow? (without a plugin)..
to try and grab the image i have made a second shortcode that does the same snapshot but doesnt wrap inside image tag for the href with the lightbox class..
.
this is the line in the theme:
<a class="lightImages" href="<?php echo do_shortcode('[snapurl url="http://www.sagive.co.il"]'); ?>"><?php echo do_shortcode('[snap url="http://www.sagive.co.il" w="175px" h="125px" alt="'.get_the_title().'"]'); ?></a>
.
any ideas?
EDITED ANSWER
Forget every thing i said before. Here is what i have found the following
To use the service above eg to get a snapshot of google.com
http://s.wordpress.com/mshots/v1/http%3A%2F%2Fwww.google.com%2F?w=300px&h=200px
Note that the url has to be properly encoded thats why you see funny characters in the url
Now light box.
which depends on colorbox (just another variant of lightbox)
or so i think :)
See this question on stackoverflow. For my case the problem is because colorbox has code like this somewherevar defaults = { photo: false; }
Solution
Change the false to true 🙂
Details
photo:false
totrue
lightbox-plusclassesactions.class.php
and replace all references tojquery.colorbox-min.js
withjquery.colorbox.js
Fix your shortcode. Here is the one iam currently using BUT it only generates images of my schools website
This is what i see
Good luck.
Accessing the image via Lightbox isn’t a problem. While you might run into performance concerns and, of course, you don’t have ultimate control over the contents of the image (it could go down), there isn’t a technical problem with loading the image via Lightbox.
Grabbing an image remotely and setting it to a featured thumbnail isn’t a huge stretch, but should probably be thought of a different way.
Take a look at this question for an idea: (http://wordpress.stackexchange.com/questions/29198/add-post-thumbnail-from-external-image-with-plugin