} else { $thumbFlag = 1; } } } else { if (!empty($content)) { $img = array(); $dom = new domDocument(); if ($dom->loadHTML($content)) { $dom->preserveWhiteSpace = false; $images = $dom->getElementsByTagName('img'); foreach ($images as $image) { $img[] = $image->getAttribute('src'); } if (sizeof($img) > 0 && $img[0] != '') { $res = createImgThumb($img[0], $conf); $logPushToS3 = $logPushToS3 + 3; if ($res == false) { if (!empty($outGoingLink) && $outGoingLink[0] != "") { $thumb = getApercite($outGoingLink, $conf); $logPushToS3++; $logCallToApercite++; $thumbFlag = 1; } else { $thumb = ""; $thumbFlag = 0; } } else { $size = getimagesize($img[0]); if ($size[0] > 320) { $thumbFlag = 2;
$info->title = $result->data->title->en; } if (isset($result->data->description->fr)) { $info->content = html_entity_decode($result->data->description->fr); } else { $info->content = html_entity_decode($result->data->description->en); } if (isset($result->data->freeText->fr)) { $info->content .= html_entity_decode($result->data->freeText->fr); } else { $info->content .= html_entity_decode($result->data->freeText->en); } // Using createImgThumb from /lib/library.php $thumbFlag = 0; if (file_exists($result->data->imageThumb)) { $res = createImgThumb(ltrim($result->data->imageThumb, "/"), $conf); } else { $res = 0; } if ($res == false) { $info->thumb = ""; } else { $thumbFlag = 1; $size = getimagesize('http://' . ltrim($result->data->imageThumb, "/")); if ($size[0] > 320) { $thumbFlag = 2; } else { $thumbFlag = 1; } $info->thumb = "thumb/" . $res; }
} } /* Begin info insertion in mongodb */ $info = new Info(); if (isset($result->data->title->fr)) { $info->title = $result->data->title->fr; } else { $info->title = $result->data->title->en; } if (isset($result->data->description->fr)) { $info->content = html_entity_decode($result->data->description->fr); } else { $info->content = html_entity_decode($result->data->description->en); } // Using createImgThumb from /lib/library.php $info->thumb = "/thumb/" . createImgThumb(ltrim($result->data->imageThumb, "/"), $conf); $info->origin = $origin; $info->filesourceTitle = $fileTitle; $info->access = $access; $info->licence = $licence; // Link to cibul description $info->outGoingLink = $url->loc; // Set timezone if not already set in php.ini if (!ini_get('date.timezone')) { date_default_timezone_set('Europe/Paris'); } $dateUpdatedAt = DateTime::createFromFormat('Y-m-d H:i:s', $result->data->updatedAt); $info->pubDate = new MongoDate($dateUpdatedAt->getTimestamp()); // Heat set to 1 for new infos $info->heat = 1; // Default yakCat
$info->originLink = $originLink; $info->origin = $origin; $info->user = 0; $info->zone = 15; $info->address = $Nom . " " . $Org_Commune; $dateUpdatedAt = DateTime::createFromFormat('Y-m-d', $datpar); $info->pubDate = new MongoDate($dateUpdatedAt->getTimestamp()); $info->eventDate = $eventDateTotal; echo '<br>dateEndPrint' . date('Y m d', $dateEndPrint); $info->dateEndPrint = new MongoDate($dateEndPrint); $info->print = 1; $info->outGoingLink = $url; $info->access = 2; $info->yakType = 2; if ($photo[0]['Path'] != '') { $info->thumb = "/thumb/" . createImgThumb(ltrim($photo[0][Path], "/"), $conf); } $info->setYakCatOuest($cat); $info->filesourceId = '50e42ac09bab884612000000'; $info->filesourceTitle = $fileTitle; $info->licence = $licence; $info->placeId = $newPlace['record']['_id']; $info->saveToMongoDB("", 1, $updateFlag); echo '<br><b>INFO:</b> <br>'; print_r($info); //------------------------------ unset($Date_ev); unset($Date); unset($Commune); echo "fin " . $baba . "</br>"; }