0

Users can add images to content. They're supposed to be uploading them to the site, but occasionally people will reference an image hosted elsewhere in the src='...'.

What is the best way to prevent these images from working (or even better, redirecting to a "This image is blocked" image)? I imagined using a hook of some sort to modify the content, or possibly a module that adds a filter to weed out these images. But it seems like a situation I could be overthinking.

Any suggestions?

0

I presume you are allowing the uploading and embedding of images via the WYSIWYG. That being the case you need to write a text filter and apply it to the text format the users are allowed to use (Filtered HTML for example). http://local.example.com/admin/config/content/formats/filtered_html

Have a look at the Examples module for how to do that.

filter_example  Defining an input filter

If you're not allowing them to upload and embed via the WYSIWYG (but uploading via a field for example) you could simply remove img from the permitted tags in your Limit allowed HTML tags filter.

| improve this answer | |
  • Users are allowed to upload files via WYSIWYG, so your solution makes sense to me. Thanks! – davidneedham Nov 8 '13 at 19:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.