在我的自定义模块中,我使用下面的代码来显示图像。图像样式“user_profile_image”的值为 50、50。
它给了我这样的 html 。
我不想在浏览器中使用 height="50"width="50"调整图像大小。
我可以在服务器上调整它的大小,以便客户端不需要高度和宽度属性。
print theme('image_style', array('path' => $res_value->_field_data['users_node_uid']['entity']->picture->uri, 'style_name' => 'user_profile_image'));
最佳答案
图像样式自动将您的样式(比例、比例和裁剪..)应用于图像并将其存储在 drupal 文件位置的单独文件夹下。 它不是像您想象的那样 HTML 调整大小的图像。验证一下删除高度和宽度属性后,可以发现显示没有变化。
图像网址包含 styles/<image-style-name>
例如:http://dummydomain.com/styles/thumbnail/testimg.jpg
关于css - Drupal - 图像调整大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29468388/