Solved

Images with unreal path

Posted on 2004-10-21
10
172 Views
Last Modified: 2013-12-24
I want to show pictures on a web sites with unreal image address to make it impossible for users to download it outside the web pages.
0
Comment
Question by:Michael_O
  • 5
  • 2
  • 2
  • +1
10 Comments
 
LVL 4

Accepted Solution

by:
eclipse2k earned 500 total points
ID: 12367879
Hello,


the best method would be, you work with a Session, and you should use a Database.

Step 1: When the user enters the site, set a Session variable:

<cfset Session.allowImages      = true>


Step 2: Create a Table, where you are Mapping your Image paths to IDs:


id       path
----------------------------------------------
1        images/myimage01.jpg
2        images/anotherone.jpg


Step 3: Create the File "getimage.cfm"

----------------------------------------------
<cfsetting enablecfoutputonly="Yes">
<cfparam name="URL.image" default="">

<cfif URL.image NEq "" AND isDefined("Session.allowImages") AND Session.allowImages Is true>
      <cfquery name="getImagePath" ....[Your DSN and so on]>
            SELECT      path
            FROM      myimages
            WHERE      id = #URL.image#
      </cfquery>
      
      <cffile action="read" file="#ExpandPath(getImagePath.path)#" variable="output">
      <cfheader name="Content-Disposition" value="inline; filename=image.jpg"> <!--- Not sure if you need this row --->
      <cfcontent type="image/pjpeg"> <!--- For example! --->

      <cfoutput>#output#</cfoutput>
</cfif>
----------------------------------------------


Step 4:

In your websites, your image tags looks like this:


<p> the image <img src="getimage.cfm?CFID=#Session.CFID#&CFTOKEN=#Session.CFTOKEN#&image=1" border="0" /></p>


This should work


regards
eclipse2k
0
 
LVL 4

Expert Comment

by:eclipse2k
ID: 12367888
of course, in Step 4 you need the <cfoutput> around...

<cfoutput><p> the image <img src="getimage.cfm?CFID=#Session.CFID#&CFTOKEN=#Session.CFTOKEN#&image=1" border="0" /></p></cfoutput>
0
 

Author Comment

by:Michael_O
ID: 12368024
Excelent, I also think it can work as well.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 7

Expert Comment

by:black0ps
ID: 12371509
Won't users be able to just access the image through their cached internet files?

-- Ian
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 12371814
Yep black0ps is correct.

Or when they are on the page they can save it
Or they can use a screen capture program....
0
 
LVL 4

Expert Comment

by:eclipse2k
ID: 12371856
I have a simiar construction here, and as far i know the browser is not caching the file in the internet files directory.
Ok, when the user saw the image once by visiting the site, there is NO WAY to prevent him from just copying the image into his clipboard or use the "Save Image As..." Function of the Browser.

But he will not be able to ever know where the image is located or how to get it once again.
So it is a quite secure way to prevent direct image linking by other sites.
This might work for a time as long as the session is still active, but when the session runs out, you wont be able to directly link the image.

eclipse2k
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 12371926
Yes it would prevent them linking to an image, but not from stealing or copying the image onto his/her own site.
0
 
LVL 4

Expert Comment

by:eclipse2k
ID: 12372181
@mrichmon

thats right! but we know that there will never be a way to protect something you can see from making a copy.
you just can add some hidden (or visible) watermarks if you need to prove that you are the copyright owner.

but i guess, that this is not the background of the question.
0
 
LVL 4

Expert Comment

by:eclipse2k
ID: 12382406
@Michael_O

do you need some more help?
0
 

Author Comment

by:Michael_O
ID: 12675565
I get failed doing it in this way.
Final page can't show the picture.

Can you check it on your server ?
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question