Web Design Forums

HTML and CSS Help

Having problems with these web design scripting? Ask here.

preventing right click also prevents hot linking?



Site of the Month Nominations
ENTER YOUR SITE NOW!

Reply
 
LinkBack Thread Tools
Old June 11 '09, 05:31 PM (#1)
ketanco is offline
WDF Regular
 
ketanco's Avatar
 
Join Date: October 2007
Posts: 228
ketanco is an unknown quantity at this point
preventing right click also prevents hot linking?

I know we really shouldnt prevent thr right clicking because it does not protect much, however, if we do that, does it automatically prevent hotlinking to our site or not? If not then I will have to go through all the steps to do that (prevent hotlinking), which I am trying to avoid for now....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old June 11 '09, 05:47 PM (#2)
mlseim is offline
WDF Staff
 
mlseim's Avatar
 
Join Date: April 2004
Location: Cottage Grove, Minnesota
Posts: 3,401
mlseim has much to be proud ofmlseim has much to be proud ofmlseim has much to be proud ofmlseim has much to be proud ofmlseim has much to be proud ofmlseim has much to be proud ofmlseim has much to be proud ofmlseim has much to be proud ofmlseim has much to be proud ofmlseim has much to be proud of
Hotlinking is a setting in either your webhost's control panel (for your site),
or you could possibly utilize .htaccess (search Google for examples).

You can also use PHP to render the image from a script,
where the end-user has no idea where it came from.

Like this ...
First, create a PHP script called "image.php" (see below).

PHP Code:
<?php 
// path to your images (where they are stored). 
// include the trailing forward slash / 
$path="/photos/"

$filename=$path.$_GET['p']; 

// Get the dimensions 
list($width_orig$height_orig) = getimagesize($filename); 

// Resize if needed (in this example, full size ... no reduction). 
$width=$width_orig
$height=$height_orig

// Example of half-size reduction. 
//$width=$width_orig/2; 
//$height=$height_orig/2; 

// Resample 
$image_p imagecreatetruecolor($width$height); 
$image imagecreatefromjpeg($filename); 
imagecopyresampled($image_p$image0000$width$height$width_orig$height_orig); 

// Output 
header('Content-type: image/jpeg'); 
imagejpeg($image_pnull100); 

// Clean-up Memory 
imagedestroy($image_p); 
?>
Now use this on your HTML pages for each image ...

<img src="image.php?p=mypic.jpg">

The source of the image will be unknown, but the image will appear.
(this is for JPG or JPEG images only).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

  Web Design Forums » Programming Help » HTML and CSS Help

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
User Infomation
Your Avatar

Site Of The Month

Ticket Cake
Ticket Cake

Ticket Cake is a drupal based event ticketing platform. It features that ability to browse events and share them.

Nominate Your Site Now!

Advertisement
WolfCMS.org

Latest Articles
- by RickM
- by bfsog

Advertisement

Partner Links



All times are GMT -4. The time now is 02:37 AM.


WebDesignForums.net is Copyright © 2010 RikeMedia.

SEO by vBSEO

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163