public function replaceImages(Flyer $flyer) { $flyer_html = $flyer->getHtml(); $crawler = new Crawler(); $crawler->addHtmlContent($flyer_html); foreach ($crawler->filter('img') as $domElement) { $attr_src = $domElement->getAttribute('src'); if (!$this->validateURL($attr_src)) { $result = $this->utilsBusiness->upladImage($attr_src, 'flyers'); $domElement->setAttribute('src', $result['url']); } } $flyer->setHtml($crawler->html()); $this->saveData($flyer); return $flyer; }
public function sendFlyer(Flyer $flyer, $contacts, $activity_id) { $params = array('sender_email' => $flyer->getEmail(), 'sender_name' => $flyer->getSenderName(), 'subject' => $flyer->getSubject(), 'html' => $flyer->getHtml(), 'subaccount' => $flyer->getUser()->getProfile()->getMandrillSubaccount(), 'tags' => array('flyer'), 'metadata' => array('activity_id' => $activity_id), 'contacts' => $contacts); return $this->mandrillBusiness->sendEmail($params); }