?
Solved

Images with unreal path

Posted on 2004-10-21
10
Medium Priority
?
180 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 2000 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
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 
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

Plug and play, no additional software required!

The ATEN UE3310 USB3.1 Gen1 Extender Cable allows users to extend the distance between the computer and USB devices up to 10 m (33 ft). The UE3310 is a high-quality, cost-effective solution for professional environments such as hospitals, factories and business facilities.

Question has a verified solution.

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

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

800 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