Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何删除HTML中的图像大小调整_Php_Drupal_Drupal 7_Image Resizing_Drupal Theming - Fatal编程技术网

Php 如何删除HTML中的图像大小调整

Php 如何删除HTML中的图像大小调整,php,drupal,drupal-7,image-resizing,drupal-theming,Php,Drupal,Drupal 7,Image Resizing,Drupal Theming,我不确定这个网站是否通过HTML重新调整图像大小,或者图像大小是否自动添加到代码中 如果要重新调整图像的大小,则需要对其进行修复,因为这会减慢页面加载时间 这是一个。您需要覆盖默认值并删除宽度和高度属性,或者将它们的值设置为自动 例如: // In your theme's template.php file function [YOUR_THEME]_image($variables) { $attributes = $variables['attributes']; $attribu

我不确定这个网站是否通过HTML重新调整图像大小,或者图像大小是否自动添加到代码中

如果要重新调整图像的大小,则需要对其进行修复,因为这会减慢页面加载时间


这是一个。

您需要覆盖默认值并删除
宽度
高度
属性,或者将它们的值设置为
自动

例如:

// In your theme's template.php file
function [YOUR_THEME]_image($variables) {
  $attributes = $variables['attributes'];
  $attributes['src'] = file_create_url($variables['path']);

  foreach (array('alt', 'title') as $key) {
    if (isset($variables[$key])) {
      $attributes[$key] = $variables[$key];
    }
  }

  return '<img' . drupal_attributes($attributes) . ' />';
}
//在主题的template.php文件中
函数[你的主题]\u图像($variables){
$attributes=$variables['attributes'];
$attributes['src']=file_create_url($variables['path']);
foreach(数组('alt','title')作为$key){
if(isset($variables[$key])){
$attributes[$key]=$variables[$key];
}
}
返回“”;
}

好的,那么你是说通过html进行了重新调整大小?不,不是我说的:)。您询问了
如何删除HTML中的图像大小调整,答案解释了如何删除。但是,为了创建图像样式预设,您应该从
?q=admin/config/media/image-styles
执行该操作。