Php 如何删除HTML中的图像大小调整
我不确定这个网站是否通过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
这是一个。您需要覆盖默认值并删除
宽度
和高度
属性,或者将它们的值设置为自动
例如:
// 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
执行该操作。