1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

replace image in post with another

Discussion in 'XenForo Questions and Support' started by Member 3639, Mar 1, 2012.

  1. Member 3639

    Member 3639 Active Member

    So i have found a website nicking my images and hotlinking directly to it and then poaching my news.

    In my post i have an image attached, where do i find this image so i can replace it with a little message for them? I tried the attachments folder but the image for it in there is tiny :S

    Ps. Is there a way to stop people being able to hot link attached files?
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    You can disable hotlinking at the server level.

    If you have cPanel you can do it from there.

    Or you can add something like this to your .htaccess file:
    Code:
    # Prohibits hotlinking of images
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://mysite.com/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http:// mysite .com$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.mysite.com/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.mysite.com$ [NC]
    RewriteRule .*\.(jpeg|gif|bmp|png|jpg)$ path/to/replacement/image.png [L]
    
    The full size images are in the internal_data directory.
     
  3. Member 3639

    Member 3639 Active Member

    I couldn't get it to work in cpanel so i sent a support ticket.

    Managed to find where they attachments are stored so i re-made a nicer image for them.

    That will teach them.
     
  4. Member 3639

    Member 3639 Active Member

    Just a note because attached files are using a php file to view the image you cannot stop hotlinking?
     
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    What is the URL of the image? You just need to change the rewriterule to match the URL in question.
     
  6. Member 3639

    Member 3639 Active Member

  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Try this:

    Code:
    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://gamingonlinux.com/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://gamingonlinux.com$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.gamingonlinux.com/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.gamingonlinux.com$ [NC]
    RewriteCond %{QUERY_STRING} attachments/.*$
    RewriteRule ^.*$ http://www.gamingonlinux.com/nohotlinking.jpg? [NC,L]
    
     
  8. Member 3639

    Member 3639 Active Member

    No that doesn't work either.
     
  9. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I know this part works:

    Code:
    RewriteEngine On
    RewriteCond %{QUERY_STRING} attachments/.*$
    RewriteRule ^.*$ http://www.gamingonlinux.com/nohotlinking.jpg? [NC,L]
    
    I didn't actually test the referral stuff.
     
  10. Member 3639

    Member 3639 Active Member

  11. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I can play with it if you give me a FTP login.
     
  12. Member 3639

    Member 3639 Active Member

    Sure i will fire you up a PM once i get a temp one sorted :)
     

Share This Page