Меняем стиль у картинок програмно

  1. function xxx_node_view($node, $view_mode, $langcode)
  2. {
  3. if($view_mode == "full" && $node->type == "article")
  4. {
  5.  
  6. $filepath = $node->field_name_image[LANGUAGE_NONE][0]['uri'];
  7. $node->content['image1'] = array
  8. (
  9. '#theme' => 'image_style',
  10. '#style_name' => 'thumbnail',
  11. '#path' => $filepath,
  12. );
  13. $node->content['field_image'] = array
  14. (
  15. '#theme' => 'image_style',
  16. '#style_name' => 'medium',
  17. '#path' => $filepath,
  18. );
  19. }
  20.  
  21. // Note: If using PHP 5.2.X, uncomment this line:
  22. // return $node;
  23. }
Russian
Категория: 
The code has been tested and works
Мультитег: 

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Target Image