具有图像样式的Drupal 8图像 [英] Drupal 8 images with image style

查看:52
本文介绍了具有图像样式的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 Drupal\image\Entity\ImageStyle;

$path = 'public://images/image.jpg';
$url = ImageStyle::load('style_name')->buildUrl($path);

这篇关于具有图像样式的Drupal 8图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆