是否有一个动态drupal图像调整器


Is there a on-the-fly drupal image resizer?

在Drupal或Drupal模块中是否有图像调整器可以让您做以下事情:

theme_image_resize($source, $heightx$width, $options);

Drupal 7提供了图像样式,允许您创建预设,包括缩放、裁剪和许多其他图像操作操作。您可以使用theme_image_style():

以编程方式调整任何图像的大小。
$options = array(
  'style_name' => 'small', // Machine name of style defined in Admin UI or image_style_save()
  'path' => 'public://myimage.png',
  'alt' => t('resized image'),
  'title' => t('resized image'),
  'attributes' => array(
    'class' => array('awesome', 'inset', 'resized'),
    'rel' => 'lightbox',
  ),
);
$image_html = theme('image_style', $options);

Drupal 6等效的是使用ImageCache,它具有类似的API和工作流。

顾名思义,ImageCache将缓存调整大小的图像,因此它不再在下一次动态调整大小。

ImageCache被移植并包含在Drupal 7的核心中,所以theme_image_style()相当于它。

这些"有效的包装器"可能是你正在寻找的。但是如果您只想要调整大小函数,那么请查看image。在Drupal核心中包含[image_resize()]

这个Drupal 6函数将调用您在Drupal站点中启用的Image Toolkit (G2或Imagemagick)。

在Drupal 6中,ImageAPI的功能非常相似,但处理图像的方式更有效,并且已经包含在Drupal 7的核心中,因此请注意Drupal 7中image_resize()参数的差异。

有相应的模块。它被称为http://drupal.org/project/image_resize_filter。您需要制作新的文本滤镜格式,只添加图像调整大小滤镜,备注滤镜机器名称。然后在代码中应用过滤器到html字符串的图像标签使用check_markup()。过滤器将查找宽度和/或高度标签来调整图像大小,并将调整后的大小保存在文件系统中以备将来使用。