Alpha Video Training
Results 1 to 7 of 7

Thread: Download images from a website

  1. #1
    Member
    Real Name
    John Berry
    Join Date
    Nov 2007
    Location
    Maryland, USA
    Posts
    626

    Default Download images from a website

    Hello all,

    I am using a grid but I'm open for other ideas. I'm not too familiar with V12.

    I have a list of products from a manufacturer with prices, UOM, Product Name, etc and one of the fields is ImageURL where an image of the part is located. Everything imports just fine and if I use the ImageURL field as a link then the user can click it and see the image. However, what I'd prefer to do is have a small picture of the product next to the product title so they at least have a clue it is the item they're looking for first before clicking the link. Is there a way to do this or will it need some coding to go to each of the links and download the picture. Is it even possible to loop through the database and download the picture for each product with Xbasic? Maybe I'm going about it wrong and I should use a UX with one (or more) of its many controls?

    Thanks in advance.

    -John

  2. #2
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,537

    Default Re: Download images from a website

    Change your ImageURL field Control Type to Image. That will pick up the url and display the image. Set the field property In-line style to width:50px to control the size displayed.

    If you want to keep your Link and add an image, you can click Insert (bottom of Available Fields) and choose Image. Then, in properties, check on Freeform layout. In Freeform template, just double-click on your ImageURL field and it will be added to the layout. The value of ImageURL will now be used in your new Image field.
    Last edited by Davidk; 04-29-2019 at 09:10 PM.

  3. #3
    Member
    Real Name
    John Berry
    Join Date
    Nov 2007
    Location
    Maryland, USA
    Posts
    626

    Default Re: Download images from a website

    Hi David,

    Thanks.

    The first part works well. I changed it to type image and works great. I then tried your second suggestion because I do need the user to see a small version and also be able to click something and go see the large version, but it didn't work. Adding an image and using the freeform layout just copied whatever is happening on the ImageURL. So, if I keep the ImageURL as a link then the second image also becomes a link. If I have the ImageURL as in your first suggestion then the second image becomes the same (an image)

    4-30-2019 9-47-54 AM.jpg

    LinkLink.jpg

  4. #4
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,537

    Default Re: Download images from a website

    Sorry... I should have run it one more time and I would have realized that it's picking up the full control. Leave your link as it is... and for the Image control change the Freeform template a bit.

    When you get into the Freeform template, on the left side, you'll see a radio button... Control and Data. It's set to Control right now... and so will copy the whole Control. Change this to Data... and then change your template a bit.

    Code:
    <img src={data.ImageURL} width="100px">
    Now you're working with only the data from the field... not all the Control HTML. Since you're working with only the Data... you now have to add in your own HTML.

  5. #5
    Member
    Real Name
    John Berry
    Join Date
    Nov 2007
    Location
    Maryland, USA
    Posts
    626

    Default Re: Download images from a website

    Hi David,

    Thank you. Works perfectly.

    If I can ask one more question. Let's say I don't want that long link displayed on the screen (it's ugly) and instead would prefer the user click the image, is there a way to do that?

    Thanks for the help

    -John

  6. #6
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,537

    Default Re: Download images from a website

    I had a feel that's where you'd be heading... yes... you can put the <img> tag inside the <a> tag. Change your Image Freeform template to...

    Code:
    <a href={data.ImgChar}>
    	<img src={data.ImgChar} width="100px">
    </a>
    Also, if you do want a link, but don't want to display that long URL, then in the Link Control you can change the property "Display what in link?". You can change that to static text like Click here for image...

    There are other options in that section as well.

  7. #7
    Member
    Real Name
    John Berry
    Join Date
    Nov 2007
    Location
    Maryland, USA
    Posts
    626

    Default Re: Download images from a website

    Cool. Thanks David. Works great.

Similar Threads

  1. Download only certain images from website.
    By MikeData in forum Alpha Five Version 11 - Desktop Applications
    Replies: 2
    Last Post: 08-11-2017, 08:53 AM
  2. Download multiple files from website using http_download gives error
    By MikeData in forum Alpha Five Version 11 - Desktop Applications
    Replies: 11
    Last Post: 08-10-2014, 11:30 AM
  3. Internal Images ($$file) and HTML editor images not showing up
    By -Jinx- in forum Application Server Version 11 - Web/Browser Applications
    Replies: 21
    Last Post: 02-18-2014, 06:01 PM
  4. Alpha Website - swf images do not appear with iPad or iPhone
    By Mike Levesque in forum Application Server Version 10 - Web/Browser Applications
    Replies: 2
    Last Post: 12-07-2012, 05:00 PM
  5. Here is an Example, Google Maps, Images, GridLinker, Download
    By peteconway in forum Application Server Version 8
    Replies: 25
    Last Post: 05-25-2010, 10:22 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •