Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Senior Member
    Join Date
    Oct 2007
    Posts
    241
    Member #
    15910
    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....

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,720
    Member #
    5580
    Liked
    718 times
    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).



Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 05:01 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com