00001 <?php
00007 class STransMediaImage extends STrans
00008 {
00013 public function doc() {
00014 return "STransMediaImage translates SNAP2 image resources into "
00015 . "embeddable HTML.";
00016 }
00017
00022 public function getInFormat() {
00023 return 'media_image';
00024 }
00025
00030 public function getOutFormat() {
00031 return 'html';
00032 }
00033
00039 public function translate($si) {
00040 $version = $si->getOption('_version');
00041 $resource = $si->getOption('_resource');
00042
00043 $which = $si->getOption('which');
00044 if($which != "thumb" && $which != "medium" && $which != "display"
00045 && $which != "original")
00046 $which = "original";
00047
00048 $html = $si->getSource()->getHTML(array('which' => $which));
00049
00050 if($html === false)
00051 $html = "<div style=\"padding: 4px; border: 1px solid black; "
00052 . "background-color: #E0E0E0; width: 8em; text-align: center;\">No Content</div>";
00053
00054 $this->sendToTarget($si, $html);
00055
00056 return true;
00057 }
00058 }
00059
00060 ?>