Solved

Images with unreal path

Posted on 2004-10-21
10
176 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

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
php.ini on ipage hosting 12 62
Two nodes for updates and forwarding 8 51
.htaccess rewrite rule to 301 redirect canonical versions of homepage to root 4 110
PHP in Apache server 20 101
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…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
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…

808 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