Images will not display when accessing them at AWS and with legacy ASP

dogsareit
dogsareit used Ask the Experts™
on
I am new to AWS. I have done a great deal of background reading/research which always helps when you are trying to resolve a problem.
That being said, I have a problem which I do not understand.
We have an ASP legacy system which will remain in ASP indefinitely.
We have stored pdfs with images – S3 in the AWS cloud.
The images and pdfs are “public”.
Part of the URL is dynamically constructed each time based on the “user” that logins (tagged onto the AWS info) We have a newer system – codeigniter/php –  which will display the pdfs and image just fine with the dynamically created URL.
But will not do so in our ASP legacy system.
I understand that by the simple use of a URL, I should be able to access the pdf etc., and particularly since the pdfs and images are “public”.
I develop using localhost, (PHP-Wampserver) but can also develop ASP.
SO my question is two fold.
Do we need to install a something on our ASP server to enable us to view the images as well??  
And what SDK must I install on my localhost (I am thinking the JavaScript and PHP)
I thought maybe it might be a security/permission issue with the ASP server accessing the cloud but that doesn’t make sense because on the ASP side, it will display the pdf but not the image.
This is becoming urgent and any help/advice/pointers would really be appreciated. Thank you.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Scott FellDeveloper & EE Moderator
Fellow 2018
Most Valuable Expert 2013

Commented:
There is a lot of information in your question. I think what you are trying to say is just, "We have codeigniter/php –  which will display the pdfs and image just fine with the dynamically created URL. But will not do so in our ASP legacy system."

Based on just that statement, I would say the following:

First of all, there is a lot of info here that is confusing. Is AWS new?  Did you use AWS previously with classic asp?  If not make sure asp is available. Can you run this code on your AWS site?
<%="hello world"%>

Open in new window

If you can, then you can run classic asp.  

Next step is to make a very simple page in static html that will load the pdf.
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>test</title>
</head>
<body>
<a href="/path_to/pdffile.pdf">Open PDF</a>
</body>
</html>

Open in new window


Get that to work with whatever pdf you are trying to display/open.  Once that works, try it out in asp that you control (not from the database)
<% 
file = "pdffile.pdf"
%>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>test</title>
</head>
<body>
<a href="/path_to/<%=file%>">Open PDF</a>
</body>
</html>

Open in new window

Once you have that working, back in with your full code that uses your database.  If it is working up to this point and not with the database, make sure to view the source, copy the html and paste it to a static html page and compare to the examples above.  What is different? If the code is working and the file is not loading, is the file in the right path or the rendered path correct?

However, you then said, "I thought maybe it might be a security/permission issue with the ASP server accessing the cloud but that doesn’t make sense because on the ASP side, it will display the pdf but not the image."

What image? Images in the pdf file? Image separate from the pdf?   Displaying the pdf and images is not a server side issue (asp) it is a client side issue (browser / html / css / javascript)

As far as the other issues you in your question, save those for another question thread and let's just work on this one thing here.

Author

Commented:
Thank you for responding. Yes, the ASP pages are able to access and display the pdf page that is stored in the AWS cloud. The ASP pages are able to access other data in the cloud without a problem.
The images are separate from the pdf. They will not display. Doesn't matter how many different computers/browsers we try, they just won't display. All I receive is the image you see when the link to the image is incorrect or image does not exist etc. HOWEVER, I can use that very same dynamically created link,  place it in a php page, and the image appears just fine. It makes no sense to me.
Scott FellDeveloper & EE Moderator
Fellow 2018
Most Valuable Expert 2013

Commented:
What is not making sense here is ASP or PHP will not come into play for displaying images that are on the server.  ASP or PHP run on the server before the page is loaded to the browser.  ASP or PHP can generate html, css and javascript that will run once the data is sent to the browser. At that time, it is just like loading static html, css and JS.

View the source of the generated code from the asp page, copy that to your code editor. Then create a new tab in your code editor and run the same in php. View the source and place in your code editor.   Can you spot any differences in the path to the image?  

It sounds like you have a coding error and your ASP code my be generating
<img src="/path_to_image/imag.jpg">

Open in new window

and your php code is generating
<img src="/path_to_image/image.jpg">

Open in new window


Double check that generated code by viewing the source.

Author

Commented:
Thank you for responding. What I decided to do was obtain a free account with AWS and do some tutorials and coding. And I discovered something very interesting which might lead to a solution. I am going to close this question for now, and again, thank you.
I created an AWS account an am experimenting with accessing my objects in a bucket.
AS well as viewing the tutorials and so forth. The tutorials and documentation are much better than what I was previously reviewing.
Scott FellDeveloper & EE Moderator
Fellow 2018
Most Valuable Expert 2013

Commented:
What was the issue?

Author

Commented:
I am not really sure since they have not responded to my email yet which asked them to check the "permissions" on the images. Like you, I am thinking it is a path/permissions issue but more leaning towards a permission issue. And here is why I think so. Here's what happened to me. I created a AWS/S3 account and created a bucket. In my bucket, I placed some images and made sure it designated as public. I copied the object url for each image and pasted them into a simple html page. When I executed the page, the images would not display. I went back into my bucket, selected an image and check the object url and to make sure the contents of the bucket was public. It was set to public. So, I checked the permissions tab. Remember, the bucket contents are marked public, and it was my understanding, if they were, I should be able to display them. But that's not what happened. In the permission section, the canonical id looked fine, so I scrolled down and low and behold, there is a "everybody". Once I clicked on everybody, and retried my html page, the image displayed just fine without changing any of its coding. The object url did not change. That is all I did.  I do not have access to their account, so I was unable to check their permissions. I sent them an email concerning the matter, but have not heard back from them yet. I will keep you posted and I don't know when I will hear back from them. Kinda interesting, isn't it ??
:)
FORGOT to add this - the images used by the legacy system are NOT  the same ones used by the PHP version.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial