You are here

public static function TwilioMedia::processMedia in Twilio SMS Integration 8

Helper function for processing attached SMS/MMS media.

Parameters

array $params The original payload from Twilio.:

Return value

array An array of files, with url and content-type keys.

1 call to TwilioMedia::processMedia()
Twilio::buildIncomingFromRequest in src/Plugin/SmsGateway/Twilio.php
Validates the webhook request and creates an SMS message object.

File

src/Utility/TwilioMedia.php, line 20

Class

TwilioMedia
Class TwilioMedia

Namespace

Drupal\sms_twilio\Utility

Code

public static function processMedia(array $params) {
  $i = 0;
  $files = [];
  while ($i < $params['NumMedia']) {
    $files[] = [
      'url' => $params['MediaUrl' . $i],
      'content-type' => $params['MediaContentType' . $i],
    ];
    $i++;
  }
  return $files;
}