Jump to content

search images with large size on google and list


XeroXer

Recommended Posts

Hi there!
I am making a search script for personal use.
I am expanding my wallpaper database and feel that searching every name on google, then clicking two links per image and then maybe downloading it takes a lot of time.
So what I want the script to do is:
* lista a empty textbox where I enter the imagename I want to find.
* search images.google.com for that name.
* On the scriptsite list all the images in their original size.
(*) If more then 50 results list them as text links or thumbnails instead.

Anyone feels like helping me with this?
Link to comment
Share on other sites

not sure if its possible to do the part when you said "get original image size"

unless theres a direct link to that on google.

but that page html you could parse from will be like

[code]
<?PHP
$google = file("http://images.google.co.uk/images?hl=en&q=".$_POST['search']);
?>[/code]

and then [color=blue]$google[/color] will be the html code of the google image page. you could parse that to only show thumbnails.
Link to comment
Share on other sites

Well google automaticly creates a direct link to the images in it's own top border when you click the thumbnails.
Shouldn't I somehow be able to get the direct link from there?
Also there check so the images exists so I don't link to a bunch of non existant images.
Link to comment
Share on other sites

got it,

when you parse the $google thing it should have this

[code]<img style="border: 1px solid ;" src="/images?q=tbn:zL2xxNRHzRtnJM:http://cdupload.com/files/download/451_5pjc3/lol.jpg" height="148" width="95">[/code]

so if that bit is [color=blue]$imgcode[/color] (you parse it :P)you do

[code]
<?PHP
$stuff = explode(":http://", $imgcode);
$stuff = explode("\" height=", $stuff[1]);
$imgsrc = "http://".$stuff[0];
?>
[/code]

and your $imgsrc is the link to the fullsize image xD
Link to comment
Share on other sites

I get an error message. As I can see this means that my webhost does not support other sites through the file command.
I also tried file_get_content but the same error there.
Can I make it work anyhow or do I have to host the php files myself?

[b]Warning:[/b] file(http://images.google.com/images?hl=en&q=gothicmadness) [[color=blue]function.file[/color]]: failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden in [b]/customers/xeroxer.com/xeroxer.com/httpd.www/gimg/gimg.php[/b] on line [b]2[/b]
Link to comment
Share on other sites

Well installed php and all on my laptop and the script kinda works.
[code]<?php
        $sokstrang = file("http://images.google.com/images?svnum=10&hl=en&lr=&btnG=Search&q=".$_POST['search']);
        foreach($sokstrang as $htmlrader => $enrad) {
                $expett = explode(":http://", $enrad);
                $exptva = explode("\" height=", $expett[1]);
                $bildlank = "http://".$exptva[0];
                if($bildlank == "http://") { echo ""; }
                else { echo $bildlank."<br>"; }
        }
?>[/code]
The problem is that google doesn't make every link on one row so the script just lists one row that is mixed up.
Can I somehow before I print the info out make every image link on one row?
Link to comment
Share on other sites

If I have an array and one of the array lines/entrys is really long.
Can I make it so that the really long line somewhere splits itself into a new line/entry in the array?

If I have this:
[code]Array
(
  [a] => 123563573476
  [b] => 22323213<>2474361414
  [c] => 3432563246324
)[/code]

Can I with any array command make that into this:
[code]Array
(
  [a] => 123563573476
  [b] => 22323213<
  [c] => >2474361414
  [d] => 3432563246324
)[/code]
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.