SitePoint Sponsor

User Tag List

Results 1 to 16 of 16
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2014
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Hide image path url

    Hi guys

    I don't think this is possible but I thought I'd ask anyway.

    Basically, I have a page with 20 car classified ads on it. Beside each description is a photo of the car. The url path of the image direct to an external website which actually hosts the images. Is there any way to hide/encrypt the url from my page if someone (or Google bot) decides to take a look at my page code?

    If it is possible then what's the best way to do this? Any help would be fully appreciated.

    Best regards

    Rod from the UK

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,810
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    It will be readable to anyone who views the page source - if it isn't then the browser will be unable to request to load the right file.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2014
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Stephen

    Thanks for your response.

    However, something like this is possible as I've seen something similar in the code below

    <%@LANGUAGE="VBSCRIPT"%>
    <%
    Set Http = CreateObject("WinHttp.WinHttpRequest.5.1")
    Http.Open "GET", "http://000.000.000.000/Jpeg/CamImg.jpg", False
    Http.SetCredentials "guest", "guest", HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
    Http.Send
    Http.WaitForResponse
    Response.ContentType = "image/jpeg"
    Response.BinaryWrite(Http.ResponseBody)
    %>

    File 2 [display.html]
    <body>
    <img src="image.asp">
    </body>

    Though I can't do multiple images

    Any ideas

    Best regards

    Rod from the UK

  4. #4
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,397
    Mentioned
    81 Post(s)
    Tagged
    3 Thread(s)
    You can use Imagemagick to get the image and save it to your site.

    This should work:
    Code:
    exec("convert http://path_to_image local.jpg");
    You should be able to do it on the fly as well but I have not tried that.
    Code:
    <?php 
    $photo="http://path_to_image "; 
    
    $cmd = "convert $photo JPG:-"; 
    
    header("Content-type: image/jpeg"); 
    passthru($cmd, $retval); 
    ?>
    The above code would need to be on a page on its own and called by this where you want to display the image:
    Code:
    <img src="Code_page.php">

  5. #5
    SitePoint Enthusiast
    Join Date
    Jan 2014
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    HI Rubble

    Thanks for your response.

    This looks more PHP than Classic ASP?

    Best regards

    Rod from the UK

  6. #6
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,397
    Mentioned
    81 Post(s)
    Tagged
    3 Thread(s)
    Yes it is php but I believe you can use Imagemagick in Classic ASP as well; Imagemagick is an external program and not built into php.

    I would not know how to do it in Classic ASP but I thought I would post a couple of examples you may be able to adapt.

  7. #7
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,629
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Does Imagemagick require a component to be installed on the server for it to work with ASP? (A quick search suggests Yes). If so then admin access to the server would be needed to install it before it could be used in ASP code.
    Ian Anderson
    www.siteguru.co.uk

  8. #8
    SitePoint Enthusiast
    Join Date
    Jan 2014
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi guys

    Thanks for your help on this.

    Unfortunately, I am unable to install components on the server this Imagemagik can't help me in this case.

    Is there an alternative solution?

    Again, any help would be fully appreciated.

    Best regards

    Rod from the UK

  9. #9
    SitePoint Addict itHighway's Avatar
    Join Date
    Jan 2008
    Location
    GUJ
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is a software named "html guardian" that can hide your image url in html. It can also encrypt html.

  10. #10
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,629
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Don't bother.

    1. It uses Javascript, so anyone viewing your site with client scripting disabled won't, well, view your site.

    2. It can be cracked anyway. http://www.myfavoritegadgets.info/truth.html
    Ian Anderson
    www.siteguru.co.uk

  11. #11
    SitePoint Enthusiast
    Join Date
    Jan 2014
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Ian

    Someone did suggest using something like this:

    <%
    Set http = Server.CreateObject("msxml2.ServerXMLHTTP")
    http.open "GET","http://othersite.com/" & Request("name"), False
    Response.BinaryWrite http.ResponseStream
    Response.End
    %>

    <img src="getImage.asp?name=xxx.jpg">

    However, I couldn't get it to work and received the following error when I ran the code:

    --------------------
    msxml3.dll error '80004005'

    Unspecified error
    --------------------

    Is there anything in this approach? Any help would be fully appreciated

    Best regards

    Rod from the UK

  12. #12
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,152
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    The theory is sound. I don't know my ASP from my elbow, but I'm guessing it's a mime-type issue.

  13. #13
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,629
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Here is a working example.

    Code:
    <%
    Response.Buffer = True
    Response.ContentType = "image/JPEG"
    Set http = Server.CreateObject("MSXML2.ServerXMLHTTP")
    http.open "GET","http://www.siteguru.co.uk/images/" & Request.QueryString("name"), False
    http.Send
    Response.BinaryWrite http.ResponseBody
    Set http = Nothing
    Response.Flush
    Response.End
    %>
    
    <html>
    <head>
    </head>
    <body>
    <img src="image.asp?name=folderoptions.jpg">
    </body>
    </html>
    Ian Anderson
    www.siteguru.co.uk

  14. #14
    SitePoint Enthusiast
    Join Date
    Jan 2014
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Superb - thanks Ian!

    What if I want to add multiple images to my page? Is this possible? I have tried the following but I only get the first image:

    ----------------------------------
    <%
    Response.Buffer = True
    Response.ContentType = "123456789/JPEG"
    Set http = Server.CreateObject("MSXML2.ServerXMLHTTP")
    http.open "GET","http://www.virtual-showroom.co.uk/images/vehicles/4483_664183_0_0.jpg", False
    http.Send
    Response.BinaryWrite http.ResponseBody
    Set http = Nothing
    Response.Flush
    Response.End
    %>
    <img src="123456789.asp?name=folderoptions.jpg">

    <hr>

    <%
    Response.Buffer = True
    Response.ContentType = "987654321/JPEG"
    Set http = Server.CreateObject("MSXML2.ServerXMLHTTP")
    http.open "GET","http://www.virtual-showroom.co.uk/images/vehicles/4483_664180_0_4.jpg", False
    http.Send
    Response.BinaryWrite http.ResponseBody
    Set http = Nothing
    Response.Flush
    Response.End
    %>
    <img src="987654321.asp?name=folderoptions.jpg">
    ----------------------------------

    Any ideas? I look forward to hearing from you

    Best regards

    Rod from the UK

  15. #15
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,629
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Save the ASP code as, say, image.asp. Then all you do is have multiple <img> tags in your HTML, with each one calling image.asp and passing the relevant filename.

    You do NOT put multiple instances of the ASP code in your page.

    And what's with changing the Response.ContentType line? That MUST stay exactly as I typed it.

    Please sit back and try to THINK about what image.asp is doing. Once this clicks in your mind it'll help you down the line. (I get the feeling you've jumped head-first into a project and found yourself way out of your depth).
    Ian Anderson
    www.siteguru.co.uk

  16. #16
    SitePoint Enthusiast
    Join Date
    Jan 2014
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Ian

    Absolutely perfect - thank you so much for all your help on this!

    Best regards

    Rod from the UK


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
  •