Topic: Removed or Non-Existant Images

Any way that if someone tries to display/use/share an image that doesn't exist or was removed it'll show a different image?

Probably explained it wrong/weirdly, but it should work like:

http://i43.tinypic.com/21kgwph.jpg

Thumbs up

Re: Removed or Non-Existant Images

Add this rules to the .htaccess file

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_URI} \.(gif|jpg|jpeg|png)$ 
RewriteRule .* path/to/noimage.gif [L]

http://www.webhostingtalk.com/showpost. … ostcount=3

rodolfoberrios.com | PLEASE use Tech Support forums to ask for support!

Re: Removed or Non-Existant Images

Added and tried, but so far, it treats it like a 404 Error and shows the 404 Page.

Thumbs up

Re: Removed or Non-Existant Images

call it before the default rules of chevereto

rodolfoberrios.com | PLEASE use Tech Support forums to ask for support!

Re: Removed or Non-Existant Images

It changes the background on some parts of my theme.

Thumbs up

Re: Removed or Non-Existant Images

Mmm... I will test it and trow you the rules.

rodolfoberrios.com | PLEASE use Tech Support forums to ask for support!

Re: Removed or Non-Existant Images

Thanks. I appreciate it. smile

Thumbs up

Re: Removed or Non-Existant Images

Added it and it seems to work on my site.

Themes: (with User System/Registration) from $25.
Hosting:  10GB Space | 1TB BW - with FREE Theme - €4 p/m
Cloud VPS: 2.4Ghz | 2048MB Ram | 120GB HDD | 3TB BW | 3 IP VPS - FREE cPANEL  - €38 p/m.

Thumbs up

Re: Removed or Non-Existant Images

http://anony.ws/i/1fB9b.png

Themes: (with User System/Registration) from $25.
Hosting:  10GB Space | 1TB BW - with FREE Theme - €4 p/m
Cloud VPS: 2.4Ghz | 2048MB Ram | 120GB HDD | 3TB BW | 3 IP VPS - FREE cPANEL  - €38 p/m.

Thumbs up

Re: Removed or Non-Existant Images

Hmm, maybe I put it in the wrong place? Where did you add that code? Never learned too much about .htaccess files.

Thumbs up

Re: Removed or Non-Existant Images

I added it at the top of the file and used an uploaded image as the image link in there.

Themes: (with User System/Registration) from $25.
Hosting:  10GB Space | 1TB BW - with FREE Theme - €4 p/m
Cloud VPS: 2.4Ghz | 2048MB Ram | 120GB HDD | 3TB BW | 3 IP VPS - FREE cPANEL  - €38 p/m.

Thumbs up

Re: Removed or Non-Existant Images

My htaccess looks like this:

ServerSignature Off
Options -Indexes


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^api$ api.php [L]
RewriteRule ^di-(.*)?$ i/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</IfModule>

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_URI} \.(gif|jpg|jpeg|png)$ 
RewriteRule .* http://anony.ws/i/1fB9b.png [L]
Options -Indexes

DirectoryIndex index.html index.php

ErrorDocument 400 default
ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 500 default

Last edited by Piers (2012-01-05 17:48:42)

Themes: (with User System/Registration) from $25.
Hosting:  10GB Space | 1TB BW - with FREE Theme - €4 p/m
Cloud VPS: 2.4Ghz | 2048MB Ram | 120GB HDD | 3TB BW | 3 IP VPS - FREE cPANEL  - €38 p/m.

Thumbs up

Re: Removed or Non-Existant Images

tonemapped wrote:

My htaccess looks like this:

ServerSignature Off
Options -Indexes


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^api$ api.php [L]
RewriteRule ^di-(.*)?$ i/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</IfModule>

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_URI} \.(gif|jpg|jpeg|png)$ 
RewriteRule .* http://anony.ws/i/1fB9b.png [L]
Options -Indexes

DirectoryIndex index.html index.php

ErrorDocument 400 default
ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 500 default

Hmm, mine doesn't work. Even copied and pasted your code. Not sure what's wrong.

Thumbs up

Re: Removed or Non-Existant Images

ServerSignature Off
Options -Indexes

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^api$ api.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</IfModule>

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_URI} \.(gif|jpg|jpeg|png)$ 
RewriteRule .* http://anony.ws/i/1fB9b.png [L]

ErrorDocument 400 default
ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 500 default

That is the only bit that you should need.

Themes: (with User System/Registration) from $25.
Hosting:  10GB Space | 1TB BW - with FREE Theme - €4 p/m
Cloud VPS: 2.4Ghz | 2048MB Ram | 120GB HDD | 3TB BW | 3 IP VPS - FREE cPANEL  - €38 p/m.

Thumbs up

Re: Removed or Non-Existant Images

Doesn't work, unless I'm using it wrong?

I'm expecting it to lead to that special image if I try to view a non-existant image.

Thumbs up