diff --git a/islandora_medium_size_service/include/islandora_medium_size_service.inc b/islandora_medium_size_service/include/islandora_medium_size_service.inc new file mode 100644 index 00000000..2dfd7df3 --- /dev/null +++ b/islandora_medium_size_service/include/islandora_medium_size_service.inc @@ -0,0 +1,50 @@ +field_medium_size[LANGUAGE_NONE][] = array( + 'fid' => $file->fid, + 'alt' => "Medium sized image for node $uuid", + 'title' => "Medium sized image for node $uuid", + ); + $node->field_tn[LANGUAGE_NONE][] = array( + 'fid' => $file->fid, + 'width' => 100, + 'height' => 100, + 'alt' => "Thumbnail for node $uuid", + 'title' => "Thumbnail for node $uuid", + ); + + node_save($node); + + return "Successfully added medium sized image to node $uuid"; +} diff --git a/islandora_medium_size_service/islandora_medium_size_service.info b/islandora_medium_size_service/islandora_medium_size_service.info new file mode 100644 index 00000000..cb6027fa --- /dev/null +++ b/islandora_medium_size_service/islandora_medium_size_service.info @@ -0,0 +1,6 @@ +name = Islandora Medium Size Service +description = "Adds medium size images to nodes" +package = Islandora +version = 7.x-dev +core = 7.x +dependencies[] = rest_server diff --git a/islandora_medium_size_service/islandora_medium_size_service.module b/islandora_medium_size_service/islandora_medium_size_service.module new file mode 100644 index 00000000..6b5319b8 --- /dev/null +++ b/islandora_medium_size_service/islandora_medium_size_service.module @@ -0,0 +1,48 @@ + array( + 'title' => t('Add Medium Size'), + 'description' => t('Allows external sources to add medium size images to nodes.'), + ), + ); +} + +/** + * Implements hook_services_resources(). + */ +function islandora_medium_size_service_services_resources() { + return array( + 'medium_size' => array( + 'create' => array( + 'help' => t('Adds a medium sized image to the node identified by UUID.'), + 'file' => array( + 'type' => 'inc', + 'module' => 'islandora_medium_size_service', + 'name' => 'include/islandora_medium_size_service', + ), + 'callback' => 'islandora_medium_size_service_create', + 'access callback' => 'user_access', + 'access arguments' => array('islandora medium size service create'), + 'args' => array( + array( + 'name' => 'args', + 'type' => 'array', + 'description' => t("JSON data containing arguments to add the medium sized image."), + 'source' => 'data', + 'optional' => FALSE, + ), + ), + ), + ), + ); +} diff --git a/islandora_tn_service/include/islandora_tn_service.inc b/islandora_tn_service/include/islandora_tn_service.inc new file mode 100644 index 00000000..08ec6de5 --- /dev/null +++ b/islandora_tn_service/include/islandora_tn_service.inc @@ -0,0 +1,47 @@ +field_tn[LANGUAGE_NONE][] = array( + 'fid' => $file->fid, + 'width' => 100, + 'height' => 100, + 'alt' => "Thumbnail for node $uuid", + 'title' => "Thumbnail for node $uuid", + ); + + node_save($node); + + return "Successfully added thumbnail to node $uuid"; +} diff --git a/islandora_tn_service/islandora_tn_service.info b/islandora_tn_service/islandora_tn_service.info new file mode 100644 index 00000000..53d6a30b --- /dev/null +++ b/islandora_tn_service/islandora_tn_service.info @@ -0,0 +1,6 @@ +name = Islandora TN Service +description = "Adds thumbnail images to nodes" +package = Islandora +version = 7.x-dev +core = 7.x +dependencies[] = rest_server diff --git a/islandora_tn_service/islandora_tn_service.module b/islandora_tn_service/islandora_tn_service.module new file mode 100644 index 00000000..e749254a --- /dev/null +++ b/islandora_tn_service/islandora_tn_service.module @@ -0,0 +1,48 @@ + array( + 'title' => t('Add Thumbnails'), + 'description' => t('Allows external sources to add thumbnails to nodes.'), + ), + ); +} + +/** + * Implements hook_services_resources(). + */ +function islandora_tn_service_services_resources() { + return array( + 'tn' => array( + 'create' => array( + 'help' => t('Adds a thumbnail to the node identified by UUID.'), + 'file' => array( + 'type' => 'inc', + 'module' => 'islandora_tn_service', + 'name' => 'include/islandora_tn_service', + ), + 'callback' => 'islandora_tn_service_create', + 'access callback' => 'user_access', + 'access arguments' => array('islandora tn service create'), + 'args' => array( + array( + 'name' => 'args', + 'type' => 'array', + 'description' => t("JSON data containing arguments to add the thumbnail."), + 'source' => 'data', + 'optional' => FALSE, + ), + ), + ), + ), + ); +}