ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Load

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
bmesser Posted - Jul 13 2011 : 00:16:10
I want to load an image from the internet by using it's URL I use ImageEnView.IO.LoadFromURL() to do this. For most simple image URL's this works fine but if it gets a little more elaborate like this one:

http://www.bbc.co.uk/travelnews/suffolk/trafficcameras/highwaysagency/56496/image/?enabled=1&asset=56496.jpg&epoch=1310540660®ion=suffolk&cachebuster=1310541125919

it fails.

If I use the WebImage component from TMS this never fails to return an image. Because the ImageEnView component offers so much more than the lightweight TMS one I would prefer to do it in ImageEn.

Personally I think loading an image by URL is a very important feature of ImageEn and saves me a lot of extra work using WinINet, if it is a problem with the component it would be great to get it fixed.
3   L A T E S T    R E P L I E S    (Newest First)
w2m Posted - Jul 14 2011 : 18:21:07
I do not know what is ocurring on your PC, but here LoadFromURL works just fine. I made a small demo that refreshes the url every 10 seconds, which it does... but I do not know how often bbc updates the camera image. It seems like it may be less frequent then 10 seconds but I have no way of knowing for sure.

I ran the demo for severval minutes until I got sick of watching headlights go by. Not much to look at at night. <grin>... I never got an exception while testing the demo even though the url was refreshed over a hundred times.

I do not see a way to attach a zip file in this forum so you can get the demo project. Send me your email and I'll send it along.

Meanwhile here is the code:
// ------------------------------------------------------------------------------
// ImageENViewURL     : 1.0
// Copyright (c) 2011 : Copyright Adirondack Software & Graphics
// Created            : 07-14-2011
// Last Modification  : 07-14-2011
// Description        : uMain Unit
// Compiler           : Delphi 2010
// This file is copyright (C) W W Miller, 1986-2011.
// It may be used without restriction. This code distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
// ------------------------------------------------------------------------------
unit uMain;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, ComCtrls, IEView, ImageENView;

type
  TForm1 = class( TForm )
    Panel1: TPanel;
    Button1: TButton;
    ImageEnView1: TImageEnView;
    StatusBar1: TStatusBar;
    Timer1: TTimer;
    CheckBox1: TCheckBox;
    ProgressBar1: TProgressBar;
    Timer2: TTimer;
    procedure Button1Click( Sender: TObject );
    procedure Timer1Timer( Sender: TObject );
    procedure CheckBox1Click( Sender: TObject );
    procedure FormCreate( Sender: TObject );
    procedure ImageEnView1FinishWork( Sender: TObject );
    procedure ImageEnView1Progress( Sender: TObject; per: Integer );
    procedure Timer2Timer( Sender: TObject );
  private
    { Private declarations }
    TimerUpdateInterval: Integer;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click( Sender: TObject );
var
  AURL: string;
begin
  Screen.Cursor := crHourglass;
  try
    // AURL := 'http://www.bbc.co.uk/travelnews/suffolk/trafficcameras/highwaysagency/56496/image/?enabled=1&asset=56496.jpg&epoch=1310540660Žion=suffolk&cachebuster=1310541125919';
    AURL := 'http://www.bbc.co.uk/travelnews/devon/trafficcameras/highwaysagency/43001/image/?region=devon&epoch=1310630764&asset=49566.jpg&enabled=1&cachebuster=1310630764';
    ImageEnView1.IO.LoadFromURL( AURL );
    ImageEnView1.Update;
    StatusBar1.Panels[ 0 ].Text := AURL;
    StatusBar1.Panels[ 0 ].Text := AURL;
    TimerUpdateInterval := 10;
    StatusBar1.Panels[ 1 ].Text := 'Click the enabled checkbox to update every 10 seconds';
  finally
    Screen.Cursor := crDefault;
  end;
end;

procedure TForm1.CheckBox1Click( Sender: TObject );
var
  AURL: string;
begin
  Timer1.Enabled := CheckBox1.Checked;
  if CheckBox1.Checked then
  begin
    Screen.Cursor := crHourglass;
    try
      // AURL := 'http://www.bbc.co.uk/travelnews/suffolk/trafficcameras/highwaysagency/56496/image/?enabled=1&asset=56496.jpg&epoch=1310540660Žion=suffolk&cachebuster=1310541125919';
      AURL := 'http://www.bbc.co.uk/travelnews/devon/trafficcameras/highwaysagency/43001/image/?region=devon&epoch=1310630764&asset=49566.jpg&enabled=1&cachebuster=1310630764';
      ImageEnView1.IO.LoadFromURL( AURL );
      ImageEnView1.Update;
      TimerUpdateInterval := 10;
      StatusBar1.Panels[ 0 ].Text := AURL;
      StatusBar1.Panels[ 1 ].Text := 'Next Refresh In: ' + IntToStr( TimerUpdateInterval ) + ' seconds';
    finally
      Screen.Cursor := crDefault;
    end;
  end
  else
    StatusBar1.Panels[ 1 ].Text := '';
  Timer2.Enabled := CheckBox1.Checked;
end;

procedure TForm1.FormCreate( Sender: TObject );
begin
  Timer1.Enabled := False;
  Timer2.Enabled := False;
  TimerUpdateInterval := 10;
end;

procedure TForm1.ImageEnView1FinishWork( Sender: TObject );
begin
  ProgressBar1.Position := 0;
end;

procedure TForm1.ImageEnView1Progress( Sender: TObject; per: Integer );
begin
  ProgressBar1.Position := per;
end;

procedure TForm1.Timer1Timer( Sender: TObject );
// load the url every 10 seconds
var
  AURL: string;
begin
  Screen.Cursor := crHourglass;
  try
    // AURL := 'http://www.bbc.co.uk/travelnews/suffolk/trafficcameras/highwaysagency/56496/image/?enabled=1&asset=56496.jpg&epoch=1310540660Žion=suffolk&cachebuster=1310541125919';
    AURL := 'http://www.bbc.co.uk/travelnews/devon/trafficcameras/highwaysagency/43001/image/?region=devon&epoch=1310630764&asset=49566.jpg&enabled=1&cachebuster=1310630764';
    TimerUpdateInterval := 10;
    ImageEnView1.IO.LoadFromURL( AURL );
    ImageEnView1.Update;
    StatusBar1.Panels[ 0 ].Text := AURL;
    Timer2.Enabled := True;
  finally
    Screen.Cursor := crDefault;
  end;
end;

procedure TForm1.Timer2Timer( Sender: TObject );
// show the elapsed time every second
begin
  Dec( TimerUpdateInterval );
  StatusBar1.Panels[ 1 ].Text := 'Next Refresh In: ' + IntToStr( TimerUpdateInterval + 1 ) + ' seconds';
end;

end.


William Miller
bmesser Posted - Jul 14 2011 : 00:30:11
William

Thanks for looking into it for me, I wasn't using the update method so I added it. I then added an TImageEnView component next to my TMS TWebImage and it still fails to return an image or anything whilst the TMS one does bring back.

I did try to attach an image but the dialog kept saying - "You must be logged on to see this page!" when I thought I was (Chrome Browser).

The URL I was using was :
http://www.bbc.co.uk/travelnews/devon/trafficcameras/highwaysagency/43001/image/?region=devon&epoch=1310630764&asset=49566.jpg&enabled=1&cachebuster=1310630764
which was returning a missing data image.
Maybe if there had been a traffic cam image available that would have worked. What happens in the application I was using is the download froze all processing - there must have been a timeout of 10 or 15 seconds before processing continued, but some the application never gets over the event and is unresponsive.
w2m Posted - Jul 13 2011 : 11:22:09
This works with no problem here with Version 4.0.0.0:
procedure TFormMain.cxButton1Click( Sender: TObject );
var
  AURL: string;
begin
  AURL := 'http://www.bbc.co.uk/travelnews/suffolk/trafficcameras/highwaysagency/56496/image/?enabled=1&asset=56496.jpg&epoch=1310540660Žion=suffolk&cachebuster=1310541125919';
  ImageEnView1.IO.LoadFromURL( AURL );
  ImageEnView1.Update;
end;


I do not think there is anything wrong with LoadFromURL.


William Miller