Solved

Images with unreal path

Posted on 2004-10-21
10
168 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
Comment Utility
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
Comment Utility
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
Comment Utility
Excelent, I also think it can work as well.
0
 
LVL 7

Expert Comment

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

-- Ian
0
 
LVL 35

Expert Comment

by:mrichmon
Comment Utility
Yep black0ps is correct.

Or when they are on the page they can save it
Or they can use a screen capture program....
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 4

Expert Comment

by:eclipse2k
Comment Utility
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
Comment Utility
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
Comment Utility
@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
Comment Utility
@Michael_O

do you need some more help?
0
 

Author Comment

by:Michael_O
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
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.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now