本文整理汇总了PHP中Functions::get_mimetype方法的典型用法代码示例。如果您正苦于以下问题:PHP Functions::get_mimetype方法的具体用法?PHP Functions::get_mimetype怎么用?PHP Functions::get_mimetype使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Functions
的用法示例。
在下文中一共展示了Functions::get_mimetype方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_images
private function get_images($records)
{
foreach ($records as $rec) {
/* not used
[http://purl.org/dc/terms/format] => jpeg
[http://purl.org/dc/terms/audience] => experts, general public
*/
$mr = new \eol_schema\MediaResource();
$mr->taxonID = $rec["http://rs.tdwg.org/dwc/terms/taxonID"];
$mr->identifier = $rec["http://purl.org/dc/terms/identifier"];
$mr->type = "http://purl.org/dc/dcmitype/StillImage";
$mr->title = (string) @$rec["http://purl.org/dc/terms/title"];
$mr->description = (string) @$rec["http://purl.org/dc/terms/description"];
$mr->accessURI = $rec["http://purl.org/dc/terms/identifier"];
if ($val = Functions::get_mimetype($mr->accessURI)) {
$mr->format = $val;
} else {
continue;
}
if ($val = self::get_license(@$rec["http://purl.org/dc/terms/license"])) {
$mr->UsageTerms = $val;
} else {
continue;
}
$mr->creator = (string) @$rec["http://purl.org/dc/terms/creator"];
$mr->publisher = (string) @$rec["http://purl.org/dc/terms/publisher"];
// $mr->subtype = (string) $rec["http://rs.tdwg.org/audubon_core/subtype"];
// $mr->Rating = (string) $rec["http://ns.adobe.com/xap/1.0/Rating"];
// $mr->audience = (string) $rec["http://purl.org/dc/terms/audience"];
// $mr->language = (string) $rec["http://purl.org/dc/terms/language"];
// $mr->CVterm = (string) $rec["http://iptc.org/std/Iptc4xmpExt/1.0/xmlns/CVterm"];
// $mr->CreateDate = (string) $rec["http://ns.adobe.com/xap/1.0/CreateDate"];
// $mr->modified = (string) $rec["http://purl.org/dc/terms/modified"];
// $mr->Owner = (string) $rec["http://ns.adobe.com/xap/1.0/rights/Owner"];
// $mr->rights = (string) $rec["http://purl.org/dc/terms/rights"];
// $mr->bibliographicCitation = (string) $rec["http://purl.org/dc/terms/bibliographicCitation"];
// $mr->derivedFrom = (string) $rec["http://rs.tdwg.org/ac/terms/derivedFrom"];
// $mr->LocationCreated = (string) $rec["http://iptc.org/std/Iptc4xmpExt/1.0/xmlns/LocationCreated"];
// $mr->spatial = (string) $rec["http://purl.org/dc/terms/spatial"];
// $mr->lat = (string) $rec["http://www.w3.org/2003/01/geo/wgs84_pos#lat"];
// $mr->long = (string) $rec["http://www.w3.org/2003/01/geo/wgs84_pos#long"];
// $mr->alt = (string) $rec["http://www.w3.org/2003/01/geo/wgs84_pos#alt"];
// $mr->contributor = (string) $rec["http://purl.org/dc/terms/contributor"];
// if($agentID = (string) $rec["http://eol.org/schema/agent/agentID"])
// {
// $ids = explode(",", $agentID); // not sure yet what separator Worms used, comma or semicolon - or if there are any
// $agent_ids = array();
// foreach($ids as $id) $agent_ids[] = $id;
// $mr->agentID = implode("; ", $agent_ids);
// }
// if($referenceID = self::prepare_reference((string) $rec["http://eol.org/schema/reference/referenceID"])) $mr->referenceID = $referenceID;
// $mr->thumbnailURL = (string) $rec["http://eol.org/schema/media/thumbnailURL"];
// if($source = (string) $rec["http://rs.tdwg.org/ac/terms/furtherInformationURL"]) $mr->furtherInformationURL = $source;
if (!isset($this->object_ids[$mr->identifier])) {
$this->object_ids[$mr->identifier] = '';
$this->archive_builder->write_object_to_file($mr);
}
}
}
示例2: create_images
private function create_images($description, $taxon_id, $media_id, $media_url, $source_url)
{
if (in_array($media_id, $this->media_ids)) {
return;
}
$this->media_ids[] = $media_id;
$mr = new \eol_schema\MediaResource();
if ($val = $this->agent_id) {
$mr->agentID = implode("; ", $val);
}
$mr->taxonID = $taxon_id;
$mr->identifier = $media_id;
$mr->type = "http://purl.org/dc/dcmitype/StillImage";
$mr->language = 'en';
$mr->format = Functions::get_mimetype($media_url);
$mr->CVterm = "";
$mr->rights = "";
$mr->Owner = "Chaloklum Diving";
$mr->title = "";
$mr->UsageTerms = "http://creativecommons.org/licenses/by/3.0/";
$mr->description = $description;
$mr->accessURI = $media_url;
$mr->furtherInformationURL = $source_url;
$this->archive_builder->write_object_to_file($mr);
}
示例3: get_images
private function get_images($sciname, $description, $taxon_id, $media_id, $media_url, $source_url, $reference_ids, $agent_ids)
{
/* this has to be done because there are many maps written in html as jpg but are actually gif. in the site these maps are not showing, meaning typo in html.
since there is only a handful of jpg maps, i set all maps to gif */
$jpeg_maps = array("343dm.jpg", "341dm.jpg", "484ddm.jpg", "535dm2.jpg", "172ms.jpg", "202md.jpg");
$parts = pathinfo($media_url);
if (!in_array($parts["basename"], $jpeg_maps)) {
$media_url = str_ireplace(".jpg", ".gif", $media_url);
}
if (in_array($media_id, $this->media_ids)) {
return;
}
$this->media_ids[] = $media_id;
$mr = new \eol_schema\MediaResource();
if ($reference_ids) {
$mr->referenceID = implode("; ", $reference_ids);
}
if ($agent_ids) {
$mr->agentID = implode("; ", $agent_ids);
}
$mr->taxonID = (string) $taxon_id;
$mr->identifier = (string) $media_id;
$mr->type = "http://purl.org/dc/dcmitype/StillImage";
$mr->language = 'en';
$mr->format = Functions::get_mimetype($media_url);
$mr->furtherInformationURL = $source_url;
$mr->CVterm = "";
$mr->Owner = "";
$mr->rights = "";
$mr->title = "Distribution of {$sciname} in North America north of Mexico";
$mr->UsageTerms = "http://creativecommons.org/licenses/by-nc/3.0/";
$mr->audience = 'Everyone';
$description = str_ireplace("available on this site", "available on the Singing Insects of North America site", $description);
$mr->description = $description;
$mr->subtype = "Map";
$mr->accessURI = (string) trim($media_url);
$this->archive_builder->write_object_to_file($mr);
}
示例4: get_images
private function get_images($rec, $reference_ids = null, $agent_ids = null)
{
/*
<specimen_multimedia>
<media>
<mediaID>1203947</mediaID>
<image_link>http://www.boldsystems.org/pics/_w300/BLPDT/10-SRNP-108212_DHJ653087+1309969002.jpg</image_link>
<photographer>Daniel H. Janzen</photographer>
<licensing>
<license>CreativeCommons - Attribution Non-Commercial Share-Alike</license>
<licenseholder>Daniel H. Janzen</licenseholder>
<licenseholder_institution>Guanacaste Dry Forest Conservation Fund</licenseholder_institution>
<year>2010</year>
</licensing>
</media>
</specimen_multimedia>
*/
if (!@$rec->specimen_multimedia) {
return;
}
$count = 0;
foreach (@$rec->specimen_multimedia->media as $media) {
if (trim(@$media->image_link) != "" && !is_numeric(stripos($media->licensing->license, "No Derivatives"))) {
$SampleID = trim($rec->specimen_identifiers->sampleid);
$ProcessID = trim($rec->processid);
$Orientation = trim($media->caption);
// start checking if image already exists from first/original images resource
$old_id = $SampleID . "_" . $ProcessID . "_" . $Orientation;
if (in_array($old_id, $this->old_bolds_image_ids)) {
echo "\n [{$old_id}] Found an old ID, will ignore \n";
$this->old_bolds_image_ids_count++;
continue;
}
// end -
$taxon_id = trim($rec->taxon_id);
if (@$this->info[$taxon_id]) {
if ($this->info[$taxon_id] == $this->max_images_per_taxon) {
echo " --- max {$this->max_images_per_taxon} images reached for [{$taxon_id}][{$rec->sciname}] -- ";
break;
}
$this->info[$taxon_id]++;
} else {
$this->info[$taxon_id] = 1;
}
$description = "";
if (@$rec->specimen_identifiers->sampleid) {
$description .= "Sample ID = " . $SampleID . "<br>";
}
if (@$rec->processid) {
$description .= "Process ID = " . $ProcessID . "<br>";
}
if (@$media->caption) {
$description .= "Caption = " . $Orientation . "<br>";
}
$rights = "";
if (@$media->licensing->year) {
$rights = "Copyright " . $media->licensing->year;
}
$rightsHolder = "";
if (@$media->licensing->licenseholder) {
$rightsHolder = $media->licensing->licenseholder;
}
if (@$media->licensing->licenseholder_institution) {
$rightsHolder .= ". " . $media->licensing->licenseholder_institution . ".";
}
$agent_ids = self::get_object_agents($media);
$mediaID = trim($media->mediaID);
$license = self::get_license($media->licensing->license);
if (trim($rec->taxon_id) != "" && $mediaID != "" && $license && Functions::get_mimetype($media->image_link) != "") {
if (in_array($mediaID, $this->do_ids)) {
echo "\n it should not pass here, just in case... \n";
continue;
} else {
$this->do_ids[] = $mediaID;
}
$mr = new \eol_schema\MediaResource();
if ($reference_ids) {
$mr->referenceID = implode("; ", $reference_ids);
}
if ($agent_ids) {
$mr->agentID = implode("; ", $agent_ids);
}
$mr->taxonID = (string) $rec->taxon_id;
$mr->identifier = (string) $mediaID;
$mr->type = "http://purl.org/dc/dcmitype/StillImage";
$mr->language = 'en';
$mr->format = (string) Functions::get_mimetype($media->image_link);
$mr->furtherInformationURL = (string) $this->sourceURL . $rec->taxon_id;
$mr->description = (string) $description;
$mr->UsageTerms = (string) $license;
$mr->Owner = (string) $rightsHolder;
$mr->rights = (string) $rights;
$mr->accessURI = (string) $media->image_link;
$mr->Rating = 2;
$this->archive_builder->write_object_to_file($mr);
}
}
}
}
示例5: get_images
private function get_images($taxon_id, $rec, $reference_ids = null, $agent_ids = null)
{
if (!$rec->Filename) {
return;
}
$exclude = array("Animals_Birds_00787.jpg", "Animals_Crustaceans_00008.jpg", "Management_ParksProtectedAreas_OtherProtections_00026.jpg");
if (in_array($rec->Filename, $exclude)) {
return;
}
$mediaURL = trim($this->eol_defined_image_path . $rec->Filename);
$description = "";
if ($rec->navigationalCategoryHierarchy) {
$description .= "<br>Category hierarchy: " . str_replace("|", " | ", $rec->navigationalCategoryHierarchy);
}
if ($rec->description) {
$description .= "<br>Description: " . $rec->description;
}
if ($rec->captureDevice) {
$description .= "<br>Capture device: " . $rec->captureDevice;
}
if ($rec->captureDetails) {
$description .= "<br>Capture details: " . $rec->captureDetails;
}
if ($rec->dateOriginal) {
if (stripos($rec->dateOriginal, "null") === false) {
$description .= "<br>Original date: " . $rec->dateOriginal;
}
}
$locality = "";
if ($rec->Geo_latitude) {
$locality .= "Latitude: " . $rec->Geo_latitude;
}
if ($rec->Geo_longitude) {
$locality .= "; Longitude: " . $rec->Geo_longitude;
}
if ($locality) {
$description .= "<br><br>Locality: " . $locality;
}
if ($life_stage = self::get_lifestage($rec)) {
$description .= "<br><br>Life stage: " . $life_stage;
}
// if($related_media = self::get_related_media($rec)) $description .= "<br><br>Related media: " . $related_media;
$location_created = "";
if ($rec->Geo_description) {
$location_created .= "Locality: " . $rec->Geo_description . ". ";
}
if ($rec->Geo_subprovince) {
$location_created .= "Sub-province: " . $rec->Geo_subprovince . ". ";
}
if ($rec->Geo_stateProvince) {
$location_created .= "State Province: " . $rec->Geo_stateProvince . ". ";
}
if ($rec->Geo_country) {
$location_created .= "Country: " . $rec->Geo_country . ". ";
}
if ($rec->Geo_continentOcean) {
$location_created .= "Continent Ocean: " . $rec->Geo_continentOcean . ". ";
}
$mr = new \eol_schema\MediaResource();
if ($reference_ids) {
$mr->referenceID = implode("; ", $reference_ids);
}
if ($agent_ids) {
$mr->agentID = implode("; ", $agent_ids);
}
$mr->taxonID = (string) $taxon_id;
$mr->identifier = (string) $rec->Filename;
$mr->type = "http://purl.org/dc/dcmitype/StillImage";
$mr->language = 'en';
$mr->format = Functions::get_mimetype($mediaURL);
if ($mr->format != "image/jpeg") {
echo "\n investigate: not jpg: {$mediaURL} [{$mr->format}] \n";
}
$mr->title = (string) $rec->title;
$mr->CreateDate = (string) $rec->dateOriginal;
$mr->CVterm = "";
// $mr->rights = "";
$info = self::process_credit_line((string) $rec->creditLine);
$mr->Owner = $info["creditLine"];
$mr->UsageTerms = $info["license"];
$mr->audience = 'Everyone';
$mr->description = (string) $description;
$mr->LocationCreated = (string) $location_created;
$mr->accessURI = $mediaURL;
// for stats
if (stripos($rec->originalFileName, "(c)") !== false) {
$this->copyrighted++;
}
$resourceid = (string) $rec->resourceid;
if (!in_array($resourceid, $this->resourceids)) {
$this->resourceids[] = $resourceid;
} else {
return;
}
if (!in_array($mr->identifier, $this->object_ids)) {
$this->object_ids[] = $mr->identifier;
$this->archive_builder->write_object_to_file($mr);
// for stats
$archiveName = (string) $rec->archiveName;
if ($archiveName) {
//.........这里部分代码省略.........
示例6: create_image_objects
private function create_image_objects($records)
{
foreach ($records as $rec) {
if (!$rec->url_foto) {
continue;
}
$rec->especie = self::clean_name($rec->especie);
$taxon_id = strtolower(str_replace(" ", "_", $rec->especie));
$mr = new \eol_schema\MediaResource();
$mr->taxonID = $taxon_id;
$mr->identifier = md5($rec->url_foto);
$mr->type = 'http://purl.org/dc/dcmitype/StillImage';
$mr->language = 'es';
$mr->format = Functions::get_mimetype($rec->url_foto);
$mr->furtherInformationURL = "http://www.acguanacaste.ac.cr/biodiversidad/voucher.php?voucher=" . $rec->voucher;
$mr->accessURI = $rec->url_foto;
$mr->thumbnailURL = $rec->url_thumb;
$mr->Owner = 'Guanacaste Conservation Area';
$mr->rights = '';
$mr->title = '';
$mr->UsageTerms = 'http://creativecommons.org/licenses/by-nc-sa/3.0/';
$mr->description = self::get_description($rec);
$mr->LocationCreated = self::get_location($rec);
if ($agent_ids = self::get_agent_ids($rec->autor)) {
$mr->agentID = implode("; ", $agent_ids);
}
if (!isset($this->object_ids[$mr->identifier])) {
$this->object_ids[$mr->identifier] = '';
$this->archive_builder->write_object_to_file($mr);
}
}
}
示例7: prepare_images
private function prepare_images($taxon, $images)
{
$reference_ids = array();
$ref_ids = array();
$agent_ids = array();
foreach ($images as $rec) {
echo "\n - " . $taxon . " - " . $rec['url'];
$media_url = $rec["image"];
echo "\n media url: " . $media_url . "\n\n";
$path_parts = pathinfo($rec["image"]);
$identifier = (string) $rec["taxon_id"] . "_" . str_replace(" ", "_", $path_parts["basename"]);
if (in_array($identifier, $this->do_ids)) {
continue;
} else {
$this->do_ids[] = $identifier;
}
$mr = new \eol_schema\MediaResource();
if ($reference_ids) {
$mr->referenceID = implode("; ", $reference_ids);
}
if ($agent_ids) {
$mr->agentID = implode("; ", $agent_ids);
}
$mr->taxonID = (string) $rec["taxon_id"];
$mr->identifier = $identifier;
$mr->type = "http://purl.org/dc/dcmitype/StillImage";
$mr->language = 'en';
$mr->format = (string) Functions::get_mimetype($media_url);
$mr->furtherInformationURL = (string) $rec['url'];
$mr->accessURI = (string) $media_url;
$mr->Owner = "";
$mr->UsageTerms = "http://creativecommons.org/licenses/by-nc-sa/3.0/";
$mr->description = (string) $rec["caption"];
$this->archive_builder->write_object_to_file($mr);
$this->create_instances_from_taxon_object($taxon, $rec, $reference_ids);
}
}
示例8: prepare_images
private function prepare_images($rec)
{
if ($mediaURLs = self::get_image_urls($rec)) {
print "\n images: " . count($mediaURLs) . "\n";
foreach ($mediaURLs as $mediaURL) {
/* not used for now
$desc = "";
if($val = $rec["Locality"]) $desc .= "Locality: " . $val . "<br>";
if($val = $rec["Size"]) $desc .= "Size: " . $val . "<br>";
if($val = $rec["Book"]) $desc .= "Book: " . $val . "<br>";
if($val = $rec["Synonym"]) $desc .= "Synonym: " . $val . "<br>";
*/
$mr = new \eol_schema\MediaResource();
$mr->taxonID = $rec["taxon_id"];
$mr->identifier = md5($mediaURL);
$mr->type = "http://purl.org/dc/dcmitype/StillImage";
$mr->format = Functions::get_mimetype($mediaURL);
$mr->Owner = "Femorale";
$mr->UsageTerms = "http://creativecommons.org/licenses/by-nc/3.0/";
$mr->accessURI = $mediaURL;
$mr->furtherInformationURL = str_replace(" ", "%20", $rec["Expr1"]);
if (!isset($this->object_ids[$mr->identifier])) {
$this->archive_builder->write_object_to_file($mr);
$this->object_ids[$mr->identifier] = '';
}
}
}
}
示例9: process_records
private function process_records($records)
{
/*
[257] => Array
(
[img] => /caribbean/resources/img/images/species/3908_3406.jpg
[url] => /caribbean/en/thefishes/species/3908
[sciname] => Xyrichtys novacula
[vernacular] => Pearly razorfish
)
*/
foreach ($records as $contributor => $contributor_images) {
foreach ($contributor_images as $rec) {
if ($rec["sciname"]) {
$taxon = new \eol_schema\Taxon();
$taxon->taxonID = str_replace(" ", "_", $rec["sciname"]);
$taxon->scientificName = $rec["sciname"];
if ($val = $rec["url"]) {
$taxon->furtherInformationURL = $this->domain . $val;
}
if (!isset($this->taxa[$taxon->taxonID])) {
$this->taxa[$taxon->taxonID] = '';
$this->archive_builder->write_object_to_file($taxon);
}
}
if ($rec["img"]) {
$temp = pathinfo($rec["img"]);
$identifier = $temp["filename"];
$agent_ids = self::process_agent($contributor);
$mr = new \eol_schema\MediaResource();
if ($agent_ids) {
$mr->agentID = implode("; ", $agent_ids);
}
$mr->taxonID = $taxon->taxonID;
$mr->identifier = $identifier;
$mr->type = 'http://purl.org/dc/dcmitype/StillImage';
$mr->format = Functions::get_mimetype($rec["img"]);
if (preg_match("/_(.*?)\\./ims", $rec["img"], $arr)) {
$mr->furtherInformationURL = $this->image_summary_page . $arr[1];
}
$mr->UsageTerms = 'http://creativecommons.org/licenses/by-nc-sa/3.0/';
$mr->accessURI = $this->domain . $rec["img"];
$mr->Owner = $contributor;
$mr->description = '';
$mr->publisher = '';
$mr->CVterm = '';
$mr->title = '';
$mr->spatial = '';
//this is 'location' in attribution in EOL's data_object page
if (!isset($this->object_ids[$mr->identifier])) {
$this->object_ids[$mr->identifier] = '';
$this->archive_builder->write_object_to_file($mr);
}
}
}
//inner loop
}
//outer loop
}
示例10: get_taxon_details
function get_taxon_details($id)
{
$languages = array("en" => self::ENGLISH_DIR, "nl" => self::DUTCH_DIR);
$description = "";
$title = "";
$identifier = "";
$mediaURL = "";
$mimeType = "";
$rightsHolder = "";
$source = "";
$texts = array();
$objects = array();
$text_rightsHolder = "";
foreach ($languages as $language => $dir) {
debug("\n {$language} - {$dir} \n");
if ($language == "nl") {
if (substr($description, strlen($description) - 2, 2) == ". ") {
$description = substr($description, 0, strlen($description) - 2) . "; ";
}
if (substr($title, strlen($title) - 2, 2) == ". ") {
$title = substr($title, 0, strlen($title) - 2) . "; ";
}
}
$xml_file = self::ECOMARE_SOURCE_DIR . "/{$dir}/" . $id . ".xml";
debug("\n Accessing: {$xml_file} \n");
if ($xml = Functions::get_hashed_response($xml_file, array('download_wait_time' => 1000000, 'timeout' => 600, 'download_attempts' => 2, 'delay_in_minutes' => 2))) {
debug(" - OK ");
foreach ($xml->content_item as $item) {
if ($item->type == 9) {
$source_url = str_ireplace("L=0", "L=2", $xml->subject_setup->source_url);
if (trim($item->file_name) != "") {
$description .= $item->image_description != '' ? "" . $item->image_description . ". " : '';
$title .= $item->header != '' ? "" . $item->header . ". " : '';
$identifier = "img_" . $item->uid;
$mediaURL = self::ECOMARE_DOMAIN . $item->file_path . $item->file_name;
$mimeType = Functions::get_mimetype($item->file_name);
$rightsHolder = $item->image_copyright;
$source = $source_url;
}
if (!in_array($item->bodytext, $texts)) {
$objects[] = array("identifier" => $item->uid, "mediaURL" => '', "mimeType" => 'text/html', "dataType" => 'http://purl.org/dc/dcmitype/Text', "rightsHolder" => '', "title" => '', "description" => strip_tags($item->bodytext), "source" => $source_url, "license" => "http://creativecommons.org/licenses/by-nc/3.0/", "subject" => "http://rs.tdwg.org/ontology/voc/SPMInfoItems#TaxonBiology", "language" => $language);
$texts[] = $item->bodytext;
}
} elseif ($item->type == 10) {
$text_rightsHolder = strip_tags($item->bodytext);
}
}
}
}
// language loop
$objects[] = array("identifier" => $identifier, "mediaURL" => $mediaURL, "mimeType" => $mimeType, "dataType" => 'http://purl.org/dc/dcmitype/StillImage', "rightsHolder" => $rightsHolder, "title" => $title, "description" => strip_tags($description), "source" => $source, "license" => "http://creativecommons.org/licenses/by-nc/3.0/", "subject" => "", "language" => "en");
$i = 0;
foreach ($objects as $object) {
if ($object["mimeType"] == 'text/html') {
$objects[$i]["rightsHolder"] = $text_rightsHolder;
}
$i++;
}
return $objects;
}
示例11: get_images
private function get_images($description, $taxon_id, $media_id, $media_url, $reference_ids, $agent_ids)
{
$description = utf8_encode(self::remove_quotes($description));
if (in_array($media_id, $this->media_ids)) {
return;
}
$this->media_ids[] = $media_id;
$bibliographicCitation = false;
if ($reference_ids = @$this->image_references[$media_id]) {
$reference_ids = array_unique($reference_ids);
$bibliographicCitation = self::get_citation($reference_ids);
}
$mr = new \eol_schema\MediaResource();
if ($reference_ids) {
$mr->referenceID = implode("; ", $reference_ids);
}
if ($agent_ids) {
$mr->agentID = implode("; ", $agent_ids);
}
$mr->taxonID = (string) $taxon_id;
$mr->identifier = (string) $media_id;
$mr->type = "http://purl.org/dc/dcmitype/StillImage";
$mr->language = 'en';
$mr->format = Functions::get_mimetype($media_url);
$mr->CVterm = "";
$mr->Owner = "";
$mr->rights = "";
$mr->title = "";
$mr->UsageTerms = "http://creativecommons.org/licenses/by-nc/3.0/";
$mr->audience = 'Everyone';
$mr->description = (string) $description;
$mr->accessURI = $media_url;
$mr->furtherInformationURL = $this->taxon_url . $taxon_id;
if ($bibliographicCitation) {
$mr->bibliographicCitation = $bibliographicCitation;
}
$this->archive_builder->write_object_to_file($mr);
}
示例12: get_images
private function get_images($rec, $agent_ids, $reference_ids)
{
$texts = $rec['texts'];
if (@$texts['map_caption'] && @$texts['map_image']) {
$description = (string) utf8_encode($texts['map_caption']);
$mediaURL = (string) utf8_encode($texts['map_image']);
$dc_identifier = "map_" . $rec['taxonID'];
if (trim($description) && trim($mediaURL)) {
$mr = new \eol_schema\MediaResource();
if ($reference_ids) {
$mr->referenceID = implode("; ", $reference_ids);
}
if ($agent_ids) {
$mr->agentID = implode("; ", $agent_ids);
}
$mr->taxonID = (string) $rec['taxonID'];
$mr->identifier = (string) $dc_identifier;
$mr->type = "http://purl.org/dc/dcmitype/StillImage";
$mr->language = 'en';
$mr->format = Functions::get_mimetype($mediaURL);
$mr->furtherInformationURL = (string) self::clean_str(trim($rec['url']));
$mr->CVterm = "";
$mr->Owner = "IUCN/SSC Tortoise and Freshwater Turtle Specialist Group";
$mr->rights = "Copyright 2009 Chelonian Research Foundation";
$mr->title = "Distribution";
$mr->UsageTerms = "http://creativecommons.org/licenses/by-nc-sa/3.0/";
$mr->audience = 'Everyone';
$mr->description = (string) $description;
$mr->subtype = "Map";
$mr->accessURI = $mediaURL;
// $mr->bibliographicCitation = '';
$this->archive_builder->write_object_to_file($mr);
}
}
}
示例13: process_record
private function process_record($rec)
{
$rec["sciname"] = self::valid_sciname($rec);
if ($rec["sciname"]) {
$taxon = new \eol_schema\Taxon();
$taxon->taxonID = str_replace(" ", "_", $rec["sciname"]);
$taxon->scientificName = $rec["sciname"];
$taxon->furtherInformationURL = $rec["page"];
if (!isset($this->taxa[$taxon->taxonID])) {
$this->taxa[$taxon->taxonID] = '';
$this->archive_builder->write_object_to_file($taxon);
}
} else {
return;
}
if ($rec["src"]) {
$agent_ids = self::process_agent();
$mr = new \eol_schema\MediaResource();
// if($reference_ids) $mr->referenceID = implode("; ", $reference_ids); //not used at the moment...
if ($agent_ids) {
$mr->agentID = implode("; ", $agent_ids);
}
$mr->taxonID = $taxon->taxonID;
if ($rec["image_id"] == "258161") {
$mr->taxonID .= ";" . str_replace(" ", "_", "Cistus creticus");
} elseif ($rec["image_id"] == "238990") {
$mr->taxonID .= ";" . str_replace(" ", "_", "Euphorbia antilibanotica");
} elseif ($rec["image_id"] == "213710") {
$mr->taxonID .= ";" . str_replace(" ", "_", "Ziziphora clinopodioides");
} elseif ($rec["image_id"] == "212647") {
$mr->taxonID .= ";" . str_replace(" ", "_", "Melanargia galathea");
} elseif ($rec["image_id"] == "212559") {
$mr->taxonID .= ";" . str_replace(" ", "_", "Galanthus");
} elseif ($rec["image_id"] == "120397") {
$mr->taxonID .= ";" . str_replace(" ", "_", "Plantago ciliata");
} elseif ($rec["image_id"] == "48044") {
$mr->taxonID .= ";" . str_replace(" ", "_", "Ixia sorrel");
} elseif ($rec["image_id"] == "231718") {
$mr->taxonID .= ";" . str_replace(" ", "_", "Ranunculus asiaticus");
}
$mr->identifier = $rec["image_id"];
$mr->type = 'http://purl.org/dc/dcmitype/StillImage';
$mr->format = Functions::get_mimetype($rec["src"]);
$mr->furtherInformationURL = $rec["source"];
$mr->UsageTerms = 'http://creativecommons.org/licenses/by-nc-sa/3.0/';
$mr->accessURI = $rec["src"];
$mr->description = utf8_encode($rec["caption"]);
$mr->Owner = '';
$mr->publisher = '';
$mr->CVterm = '';
$mr->title = '';
$mr->spatial = $rec["location"];
if (!isset($this->object_ids[$mr->identifier])) {
$this->object_ids[$mr->identifier] = '';
$this->archive_builder->write_object_to_file($mr);
}
}
}
示例14: process_images
private function process_images($rec, $url)
{
if ($html = self::get_html($url)) {
// <img src="thb/11395a_thb.gif" alt="fig Calviria solaris">
$source_urls = self::get_source_urls($html);
if (preg_match_all("/src=\"thb\\/(.*?)\"/ims", $html, $arr)) {
// http://turbellaria.umaine.edu/gif/11397a.gif
$index = 0;
foreach ($arr[1] as $image) {
// from: http://turbellaria.umaine.edu/thb/12223a_thb.gif to: http://turbellaria.umaine.edu/gif/12223a.gif
$info = self::get_folder_of_image($image);
$folder = $info["folder"];
$extension = $info["extension"];
if (!$folder) {
// e.g <img src="thb/13158jpg_thb.158" alt="fig Kuma asilhas"> http://turbellaria.umaine.edu/turb3.php?action=2&code=13158&smk=0
if (is_numeric($extension)) {
echo "\n [{$image}] \n";
$parts = explode(".", $image);
$image = $parts[0];
$image = str_ireplace("jpg_thb", "_thb.jpg", $image);
$image = str_ireplace("gif_thb", "_thb.gif", $image);
$image = str_ireplace("png_thb", "_thb.png", $image);
echo "\n [{$image}] \n";
$info = self::get_folder_of_image($image);
$folder = $info["folder"];
$extension = $info["extension"];
if (!$folder) {
echo "\n investigate no image 2 [{$url}][{$extension}] \n";
}
} else {
echo "\n investigate no image [{$url}][{$extension}] \n";
print_r($rec);
continue;
}
}
$mediaURL = $this->domain . $folder . str_ireplace("_thb", "", $image);
$mr = new \eol_schema\MediaResource();
if ($this->agent_ids) {
$mr->agentID = implode("; ", $this->agent_ids);
}
$mr->taxonID = (string) $rec["taxon_id"];
$mr->identifier = (string) $mediaURL;
$mr->type = "http://purl.org/dc/dcmitype/StillImage";
$mr->language = 'en';
$mr->format = Functions::get_mimetype($mediaURL);
$mr->title = "";
$mr->CreateDate = "";
$mr->Owner = $this->rights_holder;
$mr->rights = "";
$mr->UsageTerms = "http://creativecommons.org/licenses/by-nc-sa/3.0/";
$mr->audience = 'Everyone';
$mr->description = "";
$mr->accessURI = $mediaURL;
if (@$source_urls[$index]) {
$mr->furtherInformationURL = @$source_urls[$index];
}
if (!in_array($mr->identifier, $this->object_ids)) {
$this->object_ids[] = $mr->identifier;
$this->archive_builder->write_object_to_file($mr);
}
$index++;
}
}
}
}
示例15: prepare_species_page
function prepare_species_page($taxon, $taxon_images, $taxon_comnames, $taxon_syn)
{
$arr_scraped = array();
$arr_photos = array();
$arr_sciname = array();
$taxon_id = $taxon["SId"];
$sciname = $taxon['GenusSpecies'];
$agent = array();
$agent[] = array("role" => "project", "homepage" => "http://www.fishwisepro.com", "name" => "FishWise Professional");
$rights_holder = "FishWise Professional";
$mimeType = "text/html";
$dataType = "http://purl.org/dc/dcmitype/Text";
$mediaURL = "";
$reference = array();
$dc_source = FWP_SPECIES_PAGE_URL . $taxon['SId'];
if (trim(@$taxon['DistributionT']) != "---") {
$desc = $taxon['DistributionT'];
$desc = utf8_decode($desc);
$arr_texts[$sciname][] = self::fill_data_object($desc, "http://rs.tdwg.org/ontology/voc/SPMInfoItems#Distribution", "", $agent, $rights_holder, $mediaURL, $mimeType, $dataType, $dc_source);
}
if (trim(@$taxon['LengthMax']) > 0) {
$desc = "Maximum size: {$taxon['LengthMax']} {$taxon['LengthMaxSuffix']} {$taxon['LengthMaxType']}";
$desc = utf8_decode($desc);
$arr_texts[$sciname][] = self::fill_data_object($desc, "http://rs.tdwg.org/ontology/voc/SPMInfoItems#Size", "", $agent, $rights_holder, $mediaURL, $mimeType, $dataType, $dc_source);
}
if (trim(@$taxon['DepthRangeDeep']) > 0) {
$desc = "Depth: {$taxon['DepthRangeShallow']} - {$taxon['DepthRangeDeep']}m. ";
if (trim(@$taxon['DepthRange']) != "---") {
$desc .= "<br>{$taxon['DepthRange']}";
}
if (trim(@$taxon['Habitat']) != "---") {
$desc .= "<br><br>Habitat: {$taxon['Habitat']}.";
}
if (trim(@$taxon['HabitatNotes']) != "---") {
$desc .= " {$taxon['HabitatNotes']}";
}
$desc = utf8_decode($desc);
$arr_texts[$sciname][] = self::fill_data_object($desc, "http://rs.tdwg.org/ontology/voc/SPMInfoItems#Habitat", "", $agent, $rights_holder, $mediaURL, $mimeType, $dataType, $dc_source);
}
$arr_photos = array();
if ($arr = @$taxon_images) {
foreach ($arr as $r) {
if (trim(@$r['FileName']) != "---") {
$path_info = pathinfo($r['FileName']);
$extension = strtolower($path_info['extension']);
$mediaURL = FWP_IMAGE_URL . "{$extension}/" . trim(@$r['FileName']);
$mimeType = Functions::get_mimetype($mediaURL);
$dataType = "http://purl.org/dc/dcmitype/StillImage";
$desc = "";
if (trim(@$r['LifeStage']) != "---") {
$desc .= "Life stage: " . $r['LifeStage'];
}
if (trim(@$r['dbo_Picture_PictureNote']) != "---") {
$desc .= "<br>Note: " . $r['dbo_Picture_PictureNote'];
}
if (trim(@$r['PictureType']) != "---") {
$desc .= "<br>Type: " . $r['PictureType'];
}
if (trim(@$r['Location']) != "---") {
$desc .= "<br>Location: " . $r['Location'];
}
$desc = utf8_decode(trim($desc));
$agent = array();
$agent[] = array("role" => "photographer", "homepage" => "", "name" => @$r['DisplayName']);
$dc_source = FWP_IMAGE_PAGE_URL . "&SId=" . $r['SId'] . "&PictureId=" . $r['PictureId'];
$arr_photos[$sciname][] = self::fill_data_object($desc, "", "", $agent, $rights_holder, $mediaURL, $mimeType, $dataType, $dc_source);
}
}
}
if (@$arr_texts[$sciname] || @$arr_photos[$sciname]) {
$dc_source = FWP_SPECIES_PAGE_URL . $taxon['SId'];
$arr_scraped[] = array("identifier" => "SId-" . $taxon['SId'], "kingdom" => "", "phylum" => "", "class" => "", "order" => $taxon['OrderName'], "family" => $taxon['Family'], "sciname" => $sciname, "dc_source" => $dc_source, "texts" => @$arr_texts[$sciname], "photos" => @$arr_photos[$sciname], "references" => $reference, "comnames" => $taxon_comnames, "synonyms" => $taxon_syn);
}
return $arr_scraped;
}