Jump to content

Recommended Posts

I've done some looking around but haven't found any kind of code that does just this.  I need help with is how it will find the images / view the source of the web page.  the only thing i can think of is saving the file to a directory in the server, opening it, and then <b>somehow</b> find where the images are.

 

If it helps, all the images are .jpg, .jpeg, .gif, or .png

 

just throwing out a few functions i might need would help a lot

 

Long explanation:  I'm trying to make a script that the user (mostly myself) types in a web address, the index page most likely, and the script grabs the logo of that page.  Obviously it can't tell which image is the logo 100% of the time so we have it load the next page which displays the images it found (nothing is saved to the local server yet).  The user selects which one is the logo and this is saved to the server in its own directory.

Link to comment
https://forums.phpfreaks.com/topic/52992-solved-grabbing-a-logo-from-a-website/
Share on other sites

Do a Google search for "PHP screen scraping". Once you're able to determine the contents of a URL, just browse the text with a preg_match_all that pulls the src of all the img tags. From there, you can do your comparison without much effort.

keep in mind,

this will be a problem if the logo is referenced in CSS and not on the real page, so you might want to grab the css files as well.

 

all my sites uses divs where the logo goes, then the img is in the css. it's more flexible that way and less 1998 a la tables font tag garbage

most of the sites it'll be going through are really simple websites and the webmasters get confused with tables... i'd say at least 9/10 of them dont even have CSS files on the site

 

nonetheless its a good thing to keep in mind, thanks

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.