Last active
December 20, 2015 03:19
-
-
Save dltj/6063275 to your computer and use it in GitHub Desktop.
Modify datastream within PHP using tuque
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
module_load_include('inc', 'islandora_basic_image', 'includes/derivatives'); | |
$pid = "islandora:13"; | |
$fedora_object = islandora_object_load($pid); | |
if (!$fedora_object) { | |
drupal_set_message("Fedora Object isn't in the repo!"); | |
} | |
if (!isset($fedora_object["OBJ"])) { | |
$obj_datastream = $fedora_object->constructDatastream('OBJ', 'M'); | |
} | |
else { | |
$obj_datastream = $fedora_object["OBJ"]; | |
} | |
//dpr($obj_datastream); | |
$obj_datastream->label = 'OBJ'; | |
$obj_datastream->mimetype = 'image/png'; | |
$obj_datastream->setContentFromUrl('http://ratatosk.net/assets/screenshots/debugging-drupal/devel-dpr.png'); | |
$fedora_object->ingestDatastream($obj_datastream); | |
islandora_basic_image_create_all_derivatives($fedora_object); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment