获取 永久素材.通常为图文素材 其他素材可以在GetMaterialList获取对应地址

@param string $media_id 素材ID

@return array.
182545
public function get($media_id)
    {
        if (!is_string($media_id)) {
            $this->setError('参数错误,媒体ID参数错误');

            return false;
        }

        $queryStr = [
            'media_id' => $media_id,
        ];

        $res = $this->_post('get_material', $queryStr);

        return $res;
    }
1274526
function getMedia() {
	var results = [];

	if (extensions && extensions.hasOwnProperty('media')) {
		var sourceArray = extensions.media;

		for (index = 0; index < sourceArray.length; ++index) {
		    results.push(sourceArray[index]);
		}
	}

	return results;
}
934082
public static MaterialGetResult get_material(String access_token,String media_id){
		HttpUriRequest httpUriRequest = RequestBuilder.post()
					.setHeader(jsonHeader)
					.setUri(BASE_URI+"/cgi-bin/material/get_material")
					.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
					.setEntity(new StringEntity("{\"media_id\":\""+media_id+"\"}",Charset.forName("utf-8")))
					.build();
		return LocalHttpClient.execute(httpUriRequest,BytesOrJsonResponseHandler.createResponseHandler(MaterialGetResult.class));
	}
1297664
function getMediaItem($itemId)
    {
        $params = array(1, $this->username, $this->password, $itemId);

        return $this->sendRequest('wp.getMediaItem', $params);
    }
62220
public function get($mediaId)
    {
        $node     = 'get';
        $queryStr = ['media_id' => $mediaId];

        $res = $this->_get($node, $queryStr);

        return $res;
    }
718881
public function getForeverMedia($media_id,$is_video=false){
        if (!$this->access_token && !$this->checkAuth()) return false;
        $data = array('media_id' => $media_id);
        //#TODO 暂不确定此接口是否需要让视频文件走http协议
        //如果要获取的素材是视频文件时，不能使用https协议，必须更换成http协议
        //$url_prefix = $is_video?str_replace('https','http',self::API_URL_PREFIX):self::API_URL_PREFIX;
        $result = $this->http_post(self::API_URL_PREFIX.self::MEDIA_FOREVER_GET_URL.'access_token='.$this->access_token,self::json_encode($data));
        if ($result)
        {
            if (is_string($result)) {
                $json = json_decode($result,true);
                if ($json) {
                    if (isset($json['errcode'])) {
                        $this->errCode = $json['errcode'];
                        $this->errMsg = $json['errmsg'];
                        return false;
                    }
                    return $json;
                } else {
                    return $result;
                }
            }
            return $result;
        }
        return false;
    }
786714
public function listAction()
    {
        $repository = $this->get('phlexible_media_template.template_manager');

        $allTemplates = $repository->findAll();

        $templates = [];
        foreach ($allTemplates as $template) {
            if (substr($template->getKey(), 0, 4) === '_mm_') {
                continue;
            }

            $templates[] = [
                'key' => $template->getKey(),
                'type' => $template->getType(),
            ];
        }

        return new JsonResponse(['templates' => $templates]);
    }
799582
public function getMedia()
    {
        $mediaMapper = ($this->container->dataMapper)('MediaMapper');

        $data = $mediaMapper->find();

        $template = <<<HTML
            {% import "@admin/media/_mediaCardMacro.html" as file %}
            <div class="card-wrapper">
            {% for media in page.media %}
              {{ file.mediaCard(media) }}
            {% endfor %}
            </div>
HTML;

        $mediaHtml = $this->container->view->fetchFromString($template, ['page' => ['media' => $data]]);

        $response = $this->response->withHeader('Content-Type', 'application/json');

        return $response->write(json_encode(["html" => $mediaHtml]));
    }
25552
public function mediaDirFunc($media_dir)
    {
        /** @var UniformResourceLocator $locator */
        $locator = $this->grav['locator'];

        if ($locator->isStream($media_dir)) {
            $media_dir = $locator->findResource($media_dir);
        }

        if ($media_dir && file_exists($media_dir)) {
            return new Media($media_dir);
        }

        return null;
    }
807081
protected function prepareFile(Media $media): array
    {
        return [
            'id' => $media->id,
            'name' => $media->name,
            'size' => 1024,
            'file' => $media->getUrl(),
            'type' => $media->type,
            'data' => [
                'url' => $media->getUrl(),
                'thumbnail' => $media->getUrl(),
                'id' => $media->id,
            ]
        ];
    }
223266
public function getStream($mediaId)
    {
        $response = $request = $this->getHttpClient()->createRequest()
            ->setUrl([
                self::API_GET,
                'media_id' => $mediaId
            ])
            ->setMethod('GET')
            ->send();
        if ($response->isOk) {
            $json = json_decode($response->content, true);
            if (JSON_ERROR_NONE === json_last_error()) {
                $this->checkAndThrow($json);
            }
        }
        return $response->content;
    }
1156480
public function media()
    {
        $query =  $this->customHasManyThrough('App\Models\Media', 'App\Models\MediaRelation', 'postID', 'mediaID', 'postID', 'mediaID', $this->getTable()."_media");

        if($this->mediaField) {
            $query->where($this->getTable().'_media.field', $this->mediaField);
        }

        // We also need 'field' from media relations, so we can select media based on field name
        $query->select(['media.*',$this->getTable().'_media.field']);

        return $query;
    }
1342175
def get(self, media_id):
        
        def _processor(res):
            if isinstance(res, dict):
                if 'news_item' in res:
                    # 图文素材
                    return res['news_item']
            return res

        res = self._post(
            'material/get_material',
            data={
                'media_id': media_id
            },
            result_processor=_processor
        )
        return res
310113
public function getMediaUrls()
    {
        if ($this->_aMediaUrls === null) {
            $this->_aMediaUrls = oxNew(\OxidEsales\Eshop\Core\Model\ListModel::class);
            $this->_aMediaUrls->init("oxmediaurl");
            $this->_aMediaUrls->getBaseObject()->setLanguage($this->getLanguage());

            $sViewName = getViewName("oxmediaurls", $this->getLanguage());
            $sQ = "select * from {$sViewName} where oxobjectid = '" . $this->getId() . "'";
            $this->_aMediaUrls->selectString($sQ);
        }

        return $this->_aMediaUrls;
    }
981818
public function deleteMaterial($media_id) {
		$data = $this->getData('/cgi-bin/material/del_material', [
			'access_token' => $this->getAccessToken(),
		], Json::encode(['media_id' => $media_id]));

		return $this->errcode == 0;
	}
430845
public function delForeverMedia($media_id){
        if (!$this->access_token && !$this->checkAuth()) return false;
        $data = array('media_id' => $media_id);
        $result = $this->http_post(self::API_URL_PREFIX.self::MEDIA_FOREVER_DEL_URL.'access_token='.$this->access_token,self::json_encode($data));
        if ($result)
        {
            $json = json_decode($result,true);
            if (!$json || !empty($json['errcode'])) {
                $this->errCode = $json['errcode'];
                $this->errMsg = $json['errmsg'];
                return false;
            }
            return true;
        }
        return false;
    }
701469
def _get_media(media_types):
    """"""
    get_mapped_media = (lambda x: maps.VIRTUAL_MEDIA_TYPES_MAP[x]
                        if x in maps.VIRTUAL_MEDIA_TYPES_MAP else None)
    return list(map(get_mapped_media, media_types))