ノードに埋め込んだファイルのURLアドレスを取得する

ファイルへのパスを取得するには、file_create_url() を使用します。

たとえば Drupal 7 コアに含まれるファイルアップロード機能とイメージハンドリング機能を使った場合、1つ目のイメージファイルへの URI は node オブジェクトの中に以下のように格納されています。

$node->field_image['und'][0]['und']

そこで、この情報を元にこのファイルへの URL アドレスを取得するには、


$uri = $node->field_media_image['und'][0]['uri'];
$image_path = file_create_url($uri);

というコードを使えばいいことになります。

Comments

Your article reflects the

Your article reflects the issue people are concerned about. The article provides timely information that reflects multi-dimensional views from multiple perspectives. I look forward to reading quality articles that contain timely information from you.

-

-

thank your post

Your article is awesome! How long does it take to complete this article? I have read through other blogs, but they are cumbersome and confusing. I hope you continue to have such quality articles to share with everyone! I believe there will be many people who share my views when they read this article from you!slither io

thanks

thanks for sharing, this article is usefull for me suplemen peninggi badan terbaik

-

 I was very impressed by this

 I was very impressed by this post, this site has always been pleasant news. Thank you very much for such an interesting post. Keep working, great job

-

Best website for Web Services

Best website for Web Services in Netherlands must visit https://www.dlogic.nl

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.