Jump to content

Get Images from URL


zeal5050

Recommended Posts

Hi all,

 

I'm interested in creating a social bookmarking site similar to delicious, or digg. However I'm struggling with the conceptualization. I would like for the site to generate a screen shot of the website a user has bookmarked without them actually having to upload an image! I'm wondering if this is at all possible without me storing thousand of images on my database.

 

I searched online and I came across a few alternatives. I was primarily interested in this site, Snapcasa. The site allows you to enter a url and the gets the screen shot based on that url. Any way to incorporate this site into my project?

 

Any help would be greatly appreciated, or if you can point me to some examples of this that would be great also!

 

Regards, Zeal

Link to comment
Share on other sites

Your need to change the Apache service to 'Allow service to interact with desktop', and then control a browser (IE, FF, etc) via a COM make it full screen, tell it to go to the URL and then use imagegrabscreen, to grab the screenshot

<?php
header('Content-Type: image/png');
$im = imagegrabscreen();
imagepng($im);
imagedestroy($im);
?>

Link to comment
Share on other sites

Heres an example

<?php
$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$browser->Navigate("http://www.libgd.org");

/* Still working? */
while ($browser->Busy) {
    com_message_pump(4000);
}
$im = imagegrabwindow($handle, 0);
$browser->Quit();
imagepng($im, "iesnap.png");
imagedestroy($im);
?>

Link to comment
Share on other sites

hmm I don't think this solution will work for me.

 

I don't think my hosting will allow me to run iexplore. I have come across another solution that uses the SnapCasa API, but I'm having trouble understanding how to implement it in my site. Maybe someone here can shed some light on this.

 

<?php

ini_set("display_errors", "on");
error_reporting(E_ALL);

define("CODE", "1234"); // depend on what is "User Code" when you register with snapcasa.com
define("LOCATION", "http://www.myserver.com/php/images"); // Location to store the thumbnail
define("SIZE", "S"); // size of the thumbnail: T, S, M, L

function generate_site($url) 
{
$name = str_replace(".", "", $url);
$thumb = LOCATION.$name.'.jpg';
$request_for ='http://snapcasa.com/Get.aspx?code='.CODE.'&size='.SIZE.'&url=http://'.$url;
copy($request_for, $thumb);
}

echo "<h3>This is a test of the SnapCasa API<h3>";

generate_site("www.google.com");

?>

 

There must be a simpler way to get user generated thumbnail images! ???

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.