UploadAttachedMediaRequest.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <?php
  2. /**
  3. * Class UploadAttachedMediaRequest
  4. *
  5. * Aliyun VoD's Upload Attached Media(such as watermark,subtitle files) Request class, which wraps parameters to upload an image into VoD.
  6. * Users could pass parameters to AliyunVodUploader, including File Path,Title,etc. via an UploadAttachedMediaRequest instance.
  7. * For more details, please check out the VoD API document: https://help.aliyun.com/document_detail/98467.html
  8. */
  9. class UploadAttachedMediaRequest
  10. {
  11. /**
  12. * UploadAttachedMediaRequest constructor.
  13. * @param $filePath
  14. * @param $businessType, optional values: "watermark", "subtitle" and and so on.
  15. * @param null $title
  16. * @throws Exception
  17. */
  18. public function __construct($filePath, $businessType, $title=null)
  19. {
  20. $this->setFilePath($filePath, $title);
  21. $this->businessType = $businessType;
  22. }
  23. public function getFilePath() {
  24. return $this->filePath;
  25. }
  26. public function setFilePath($filePath, $title=null) {
  27. $this->filePath = $filePath;
  28. $fns = AliyunVodUtils::getFileName($this->filePath);
  29. $this->fileName = $fns[0];
  30. $extName = AliyunVodUtils::getFileExtension($this->fileName);
  31. if (empty($extName)) {
  32. throw new Exception('filePath has no Extension', 'InvalidParameter');
  33. }
  34. $this->mediaExt = $extName;
  35. if (isset($title)) {
  36. $this->title = $title;
  37. }
  38. else {
  39. if (!isset($this->title)) {
  40. $this->title = $fns[1];
  41. }
  42. }
  43. }
  44. public function getFileName() {
  45. return $this->fileName;
  46. }
  47. public function getBusinessType() {
  48. return $this->businessType;
  49. }
  50. public function getMediaExt() {
  51. return $this->mediaExt;
  52. }
  53. public function getFileSize() {
  54. return $this->fileSize;
  55. }
  56. public function setFileSize($fileSize) {
  57. $this->fileSize = $fileSize;
  58. }
  59. public function getTitle() {
  60. return $this->title;
  61. }
  62. public function setTitle($title) {
  63. $this->title = $title;
  64. }
  65. public function getCateId() {
  66. return $this->cateId;
  67. }
  68. public function setCateId($cateId) {
  69. $this->cateId = $cateId;
  70. }
  71. public function getTags() {
  72. return $this->tags;
  73. }
  74. public function setTags($tags) {
  75. $this->tags = $tags;
  76. }
  77. public function getDescription() {
  78. return $this->description;
  79. }
  80. public function setDescription($description) {
  81. $this->description = $description;
  82. }
  83. public function getStorageLocation() {
  84. return $this->storageLocation;
  85. }
  86. public function setStorageLocation($storageLocation) {
  87. $this->storageLocation = $storageLocation;
  88. }
  89. public function getUserData() {
  90. return $this->userData;
  91. }
  92. public function setUserData($userData) {
  93. $this->userData = $userData;
  94. }
  95. public function getAppId() {
  96. return $this->appId;
  97. }
  98. public function setAppId($appId) {
  99. $this->appId = $appId;
  100. }
  101. public function getWorkflowId() {
  102. return $this->workflowId;
  103. }
  104. public function setWorkflowId($WorkflowId) {
  105. $this->workflowId = $WorkflowId;
  106. }
  107. private $filePath = null;
  108. private $fileName = null;
  109. private $fileSize = null;
  110. private $businessType = null;
  111. private $mediaExt = null;
  112. private $title = null;
  113. private $cateId = null;
  114. private $tags = null;
  115. private $description = null;
  116. private $storageLocation = null;
  117. private $userData = null;
  118. private $appId = null;
  119. private $workflowId = null;
  120. }