简体   繁体   English

当我将它们保存为.HTML文件时,我的PrettyPhoto图像会变形。

[英]My PrettyPhoto images get distorted when I save them as an .HTML File

My prettyPhoto images get distorted when I save them as an .HTML File. 将它们另存为.HTML文件时,我的prettyPhoto图像会变形。 When I save the page as .html or .htm the images become distorted, when I save the page as .php the PrettyPhoto images are fine. 当我将页面另存为.html或.htm时,图像会变形,当我将页面另存为.php时,PrettyPhoto图像就可以了。

Here's what happens.. http://Handyman-Services.NYC/NYC-Handyman-Services.php the images are fine. 这就是发生的情况。http://Handyman-Services.NYC/NYC-Handyman-Services.php图像很好。

When save as .html.. http://Handyman-Services.NYC/NYC-Handyman-Services.html the images are distorted...? 当另存为.html时。http://Handyman-Services.NYC/NYC-Handyman-Services.html图像变形了吗?

What am I missing here...please help. 我在这里想念的是什么...请帮忙。 Thanks JB 谢谢JB

Solution: Remove the height attribute from your images. 解决方案:从图像中删除高度属性。

The distortion is due to the explicitly defined width and height of the images. 失真归因于图像的明确定义的宽度和高度。 The images have CSS styling overriding the width to scale down to 100% of the parent container, but the image height is unchanged so it looks distorted (because the aspect ratio of the image is not maintained). 图像具有CSS样式,可以覆盖宽度以缩小到父容器的100%,但是图像高度没有变化,因此看起来失真(因为不保持图像的纵横比)。

The explicit width and height attributes are missing from the images in the PHP file so that is why it is not distorted. PHP文件中的图像缺少显式的width和height属性,因此这就是为什么它不会失真的原因。

you have width and height set on the tags when you save it as .html. 将其另存为.html时,您已在标签上设置了宽度和高度。 Possibly because you're using an editor of some sort. 可能是因为您正在使用某种编辑器。 Remove the width and height properties and it works fine. 删除width和height属性,它可以正常工作。

You have this in the HTML file: 您在HTML文件中有此文件:

<li class="" style="width: 100%; float: left; margin-right: -100%; position: relative; opacity: 0; display: block; z-index: 1;">
    <img height="666" width="1920" draggable="false" src="assets/extra-images/NY_Handyman_Services_Voted_Number_One_Handyman_Service_of_2015.jpg">
</li>

You should have this: 你应该有这个:

<li class="" style="width: 100%; float: left; margin-right: -100%; position: relative; opacity: 0; display: block; z-index: 1;">
    <img draggable="false" src="assets/extra-images/NY_Handyman_Services_Voted_Number_One_Handyman_Service_of_2015.png">
</li>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 file_get_contents()中包含来自网址的图片,并将其保存在zip中 - file_get_contents() with images from a url and save them in zip 当我将所有图像都设置为col-6时,为什么我的图像彼此位于较低的位置? - Why do my images get positioned below each other when I set all of them to col-6? 尝试从数据库中获取图像时,为什么我的图像没有出现 - Why is my images not appearing, when trying to get them from database 如何切片图像并使用PHP保存它们? - How can I slice images and save them using PHP? 如何让我的 php 文件正确读取这些图像? - How do I get my php file to read these images correctly? 使用prettyPhoto插件,我无法从服务器加载视频吗? - using prettyPhoto plugin I can not load video from my server? 使用php从目录中读取文件然后在我的html文件中显示它们时的处理 - Process when reading files from directory with php then showing them in my html file PDF操作-对PDF文件进行几次连续操作后图像变形 - PDF manipulation - images are distorted after few consecutive operations on PDF file 我无法将一些Facebook图像保存到我的服务器,因为它不了解该文件 - I cant save some facebook images to my server as it does not understand the file 允许用户键入html标记并将其保存到文件以在网站上显示 - Allowing user to type html tags and save them to file to display on website
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM