Solved

downloading images from URL links

Posted on 2011-03-03
10
436 Views
Last Modified: 2013-12-25
I have a database with images for each product.

the field for images is populated with urls for the images.

how can i download all the images from the urls?
ideally i would be able to choose what to name each image also.

is there a program or script i can run to do this?
0
Comment
Question by:gleverator
10 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
You may want to click the "Request Attention" link and ask that the appropriate web zones get added to this Q.
0
 
LVL 39

Expert Comment

by:gdemaria
Comment Utility

what language are you coding in?  Php, coldfusion, asp...
0
 
LVL 38

Expert Comment

by:puppydogbuddy
Comment Utility
try downloading Infranview, a well known free graphics viewer, editor, etc.  See this link:
          http://www.irfanview.com/
0
 
LVL 51

Accepted Solution

by:
Bill Prew earned 250 total points
Comment Utility
Hard to be sure exactly what you are after, if you want real time download and display of the images in an application, or not.  Since you mentioned renaming images it sounds more like you might want to pull them all at once to a local location for the application to use.  If that is the case then take a look at the WGET free utility, it's great at pulling things from the web and storing local copies.

http://www.gnu.org/software/wget/

~bp
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 38

Expert Comment

by:Insignificant Volunteer
Comment Utility
Yes there are some methods that you could adopt using a couple of 3rd-party programs, but it depends on several aspects that perhaps you can explain a little bit more about to see whether my proposed suggestion would be suitable for your needs:

1. Are you trying to run a script from WITHIN your Database, eg. using VBA Scripting?

2. Are you trying to run Perl, VBS, JavaScript from within a Web Page?

3. If neither, and an EXTERNALLY run script is what you are looking for, then do you have a text-based list of URLs that can be used as a "list file" for a script that does the image downloading?

4. Do the URLs contain any special characters or spaces in the file names?  The characters may have to be anticipated in advance for a batch scripted method, such as finding and replacing %20 in the target file name with spaces when saving the file locally.

The following assumes that:
1. You have a text-based "list file" of URLs, each one on a new line,
2. That the server's folders are accessible to a browser, ie. no 404.php files or default.htm files to deliberately stop image browsing,
3. That the suggested small, old, but still functional, 3rd-party program runs in your Operating System:

URL2File:
http://www.chami.com/free/url2file_wincon.html
Called from a batch file that parses a list file containing fully qualified URLs, you can download the images to a new or existing folder of choice and optionally rename them.  For example, the following batch file should function:

 
@echo off
SetLocal EnableDelayedExpansion
set LISTFILE=C:\Images\ImgList.txt
set SAVEFOLDER=C:\Images\Downloaded
set PROGEXE=C:\Program Files\URL2File\URL2FILE.EXE
set SUFFIX=_downloaded

for /f "tokens=* delims=" %%A in ('type listfile.txt ^| find /i ".jpg"') do (
    echo.
    set URL=%%A
    set FILE=%%~nA
    set NAME=%%~nxA
    set EXT=%%~xA
    set FILE=!FILE:http://=!
    set FILE=!FILE:/=,!
    set FILE=!FILE:%%20=?!
    set FILE=!FILE: =?!
    set FILE=!FILE:?= !
    echo Downloading File: !NAME!
    call "%PROGEXE%" -o 15 "!URL!" "%SAVEFOLDER%\!FILE!%SUFFIX%!EXT!"
    echo. 
)
pause

Open in new window

0
 
LVL 38

Expert Comment

by:Insignificant Volunteer
Comment Utility
Hi Bill.  I see we were thinking along the same lines as we tried to interpret gleverator's exact needs.  I went away for something to eat and came back, hence the delay in posting.  I hadn't read your suggestion.
0
 
LVL 51

Expert Comment

by:Bill Prew
Comment Utility
It's all good Bill.

~bp
0
 
LVL 38

Expert Comment

by:Insignificant Volunteer
Comment Utility
gleverator

In case you do test my suggested batch file, be aware of the following:

1. It is set to search the listfile for URLs that have their target as .JPG files.  That can probably be changed easily enough.

2. If browsing to the web server folder is prevented using a simple method like a 404.php or default.htm file in that folder. then URL2File will download whatever it sees in that folder, which could be the HTM or other file.  The file is saved as whatever the file extension of the called URL was, even though it is not an image file.

3. To use it, just modify the paths in the   set=   lines in the upper part of the batch file before the FOR loop.  Don't modify any other contents unless it doesn't work and you know why and how.

4. If at first the URL2File commands fail, you can run the program with switches that allow debugging:
-d = Enable debug mode.  Display warnings and other miscellaneous information.  Must be specified before other parameters.
-h = Display web server's response headers.
-o n = Timeout value in seconds (n) before aborting.
There are switches for sending a user name and password, proxy details, and a few others to look at also if required.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now