in reply to Re^5: Difficulty with using LWP to display JPEG
in thread Difficulty with using LWP to display JPEG

Roboticus - I am writing a script that displays images to the browser to ensure that they are there. It is not enough to verify that the file exists, it must also be displayed to ensure it is the correct file.

A further caveat is that the files are on a server with HTTP authentication using .HTACCESS. I know that I can do things like:

$req->authorization_basic('user', 'pass'); to gain access to such images.

I do not know that I need to automate IE, or Firefox, or Chrome (in my case I use chrome), so much as I need to find a way to display images that require authentication.

Initially I had simple HTML tags in my code printing like this:

print "<img height=\"$x\" width=\"$y\" src=\"$ImagePath\">";

However in the case of images that are behind .HTACCESS I would run into a login prompt over and over and over again.

Thanks again Roboticus!

Replies are listed 'Best First'.
Re^7: Difficulty with using LWP to display JPEG
by roboticus (Chancellor) on Apr 11, 2014 at 21:39 UTC

    Aquilae:

    If you just need to display them, then you can save them to a file, then tell IE to display the file. I think you can do it using the system command, something like:

    my $path_to_image = "D:/testing/image.jpg"; system("C:/Program Files/Internet Explorer/iexplore.exe", "file:///" . + $path_to_image);

    The bad part is, you can tell it to only show the one image, then the user will have to terminate IE when they're done. You could possibly fix the first problem by making a "wrapper" html page to include references to all the images you want the user to verify, with the filename immediately before them so they could easily check.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.