Save and image from a page automatically

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
conundrum
Forum Newbie
Posts: 15
Joined: Sun Jun 29, 2003 12:18 pm
Location: Ontario, Canada

Save and image from a page automatically

Post by conundrum »

This is a weird one.

Here's an example. Lets say you load up a page in mapquest with a map on it, and you want to save that image on your hard drive to email to someone or print. Is there any way to have php "read through" the page source, find images and save them?

Any thoughts or gently nudges in the right direction would be appreciated.
pootergeist
Forum Contributor
Posts: 273
Joined: Thu Feb 27, 2003 7:22 am
Location: UK

Post by pootergeist »

My first advice would be to read (and fully read agin) the legal documentation concerning images and data on the site you aim to steal from.

http://www.mapquest.com/about/copyright.adp

The way I read that seems to indicate that what you desire is in breach of their copyright policies and will probably end up with you in court.

On an aside: they do provide facility (from their site - which probably means including their advertising) for both emailing and printing.
conundrum
Forum Newbie
Posts: 15
Joined: Sun Jun 29, 2003 12:18 pm
Location: Ontario, Canada

Post by conundrum »

Yeah, now that I read that question I guess that's how it sounds. 8O I apologize, let me elaborate.

I am purchasing a map generating software package which works much like mapquest. It generates a page similar to a mapquest map and I am going to run it on a main server. I have several other computers that can access this server remotely but they have a flash interface. I want to be able to send map images over to those computers to display in a flash movie. The flash movie will display the map showing directions from the current location to a location they want to visit nearby.

BTW, there are 2 packages I am considering to generate maps if anyone has any experience or advice about them.
http://www.esri.com/software/routemapims/index.html (I am leaning this way), OR
http://www.mapinfo.com/products/Overvie ... uctid=1144

Can anyone tell me if this can be done?
conundrum
Forum Newbie
Posts: 15
Joined: Sun Jun 29, 2003 12:18 pm
Location: Ontario, Canada

Post by conundrum »

I have been searching for a solution to this and have come across a Javascript solution...well sort of...

As I said in my reply to pootergeist, I am planning the PURCHASE of mapping software similar to mapquest but residing on my own server. When a map is generated I will need to give it a "name" in the <IMG> tag and then a javascript function can save it.

The only problem I am encountering now is that the <img src=... won't be an actual image name like "image.jpg" it ends up being a long string of gobbledy gook because it is generated on the fly.

For example, this is from the demo site of the software package I am considering purchasing.
<IMG NAME="anImage" SRC="http://routemap.esri.com/ scripts/ webgate.dll/ routemap/ roman/ MAPSERVICE? MID=UC2001& V=200& T=%2d558%2e2572208738& L=881%2e6479854369& R=884%2e8032281554& B=%2d560%2e6122208738& X=415& Y=310& RSX=883%2e0625& RSY=%2d560%2e24125& RSN=8444+International+Dr%2c+Orlando%2c+FL+32819& RSA=0& RSX=883%2e51875& RSY=%2d558%2e46& RSN=6200+International+Dr%2c+Orlando%2c+FL+32819& RSA=0& RID=198%2e102%2e62%2e76DGMVOFKZDZQRMI& RPREF=50%2e0& ROPT=0& RWEIGHT=1& TM=1066231918656& MU=0& LU=en& IF=0& IL=1& Cmd=UpdateMap" border=0>
Admin Edit: Added spaces to the URL to allow it to wrap.

Does anyone know a way to get around this problem?
microthick
Forum Regular
Posts: 543
Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC

Post by microthick »

I used to use a shell command called "wget" to retrieve files via http before.

A combination of php and wget should be able to do what you need.

http://www.google.com/search?q=wget&sou ... 8&oe=utf-8
Stoneguard
Forum Contributor
Posts: 101
Joined: Wed Aug 13, 2003 9:02 pm
Location: USA

Post by Stoneguard »

Not too sure, but wouldn't fopen do it?

http://us4.php.net/manual/en/function.fopen.php

It talks about opening URLs
Post Reply