Solved

Images with unreal path

Posted on 2004-10-21
10
177 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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.
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

726 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