Drupal 8 图像与图像风格 [英] Drupal 8 images with image style
本文介绍了Drupal 8 图像与图像风格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 drupal 7 中,我使用函数 image_style_url('style', uri)
生成具有样式的新图像并返回图像的路径.那么在drupal 8 中会是什么呢?谢谢
In drupal 7, i use function image_style_url('style', uri)
to generate new image with style and return image's path. so what will be instead of it in drupal 8? thanks
推荐答案
根据更改记录:
use DrupalimageEntityImageStyle;
$path = 'public://images/image.jpg';
$url = ImageStyle::load('style_name')->buildUrl($path);
这篇关于Drupal 8 图像与图像风格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文