Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Displaying images from Amazon on my website

Posted on 2011-03-24
3
Medium Priority
?
465 Views
Last Modified: 2013-12-25
I'm not too familiar with web design. I want to set up a simple website (offline) that displays random images (one at a time) from the Amazon catolog. Is this to do for free?
0
Comment
Question by:graziazi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 1000 total points
ID: 35214526
Where will you get the images?  Do you have permission to use them?  Once you can answer those, you should be able to copy and save the images in your own web site directories.  Getting a random number is a fairly standard feature of most programming languages.  In PHP, I use this code to choose a random image.
// SET THE DEFAULT IMAGE URL
$banner_url   = 'images/florida_beach.jpg';

// CHOOSE A JPG BANNER IMAGE FROM THE BANNERS DIRECTORY
$my_dir = 'banners/';

// OPEN THE BANNERS DIRECTORY
if ($dh = opendir($my_dir))
{
    // MAKE AN ARRAY OF THE JPG IMAGE FILE NAMES
    $b = array();
    while (($filename = readdir($dh)) !== FALSE)
    {
        // CHOOSE ONLY JPG IMAGES
        $file_ext = strtoupper(end(explode('.', $filename)));
        if ($file_ext != 'JPG') continue;
        
        // ELIMINATE ANY FILES THAT START WITH "W"
        if (strtoupper(substr($filename,0,1)) == 'W') continue;
        $b[] = $filename;
    }
    closedir($dh);    
    
    // WITH ALL FILE NAMES IN AN ARRAY, RANDOMIZE THE LIST AND CHOOSE ONE
    shuffle($b);
    $banner_name  = array_pop($b);
    $banner_url   = $my_dir . $banner_name;
    
    // RELEASE THE SHUFFLED ARRAY
    unset($b);
}

Open in new window

0
 

Author Comment

by:graziazi
ID: 35217530
Hi Ray, thanks for that PHP example. I will be using PHP so that will be useful.
I'm not really familiar with the concept of APIs and web services. Even if I had a small number (approx 100) of random images of items I will be happy with that.
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 35220088
OK, I don't know where APIs and web services fit into this equation.  But I am sure that Amazon has millions of images.  The key to success may be whether you have permission to use Amazon's images.
0

Featured Post

Simplify Your Workload with One Tool

How do you combat today’s intelligent hacker while managing multiple domains and platforms? By simplifying your workload with one tool. With Lunarpages hosting through Plesk Onyx, you can:

Automate SSL generation and installation with two clicks
Experience total server control

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

704 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