O'Reilly logo

Twilio Cookbook Second Edition by Roger Stringer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Filtering picture messages

Since we're opening this up to allow others to send photos to our gallery, we want to keep it family friendly. We're going to do this by adding two types of checks.

The first check will make sure that the message doesn't contain any obscene words and the second will be to check the image to make sure there's no nudity.

Getting ready

The complete code for this recipe can be found in the Code/Recipe4/ folder.

How to do it…

We're going to modify our photo gallery to check incoming messages for profanity and inappropriate photos.

  1. First, upload ImageFilter.class.php to your photo gallery site.
  2. Next, update functions.php, which adds the profanity filter checker with the following code:
    <?php function cache_image( $imageurl = '',$name ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required