简体   繁体   English

从本地迁移到服务器时,内容中的Drupal图像损坏

[英]Drupal images in content break when migrating from local to server

I'm developing a site locally using xampp. 我正在使用xampp在本地开发站点。 The path the images are using is 图像使用的路径是

/devsite/sites/default/files/icon_facebook.jpg /devsite/sites/default/files/icon_facebook.jpg

When I check out of the site on my server the path remains the same for the images, even though the image is now at 当我从服务器上的站点签出时,即使图像位于当前位置,图像的路径也相同

/~devsite/sites/default/files/icon_facebook.jpg /~devsite/sites/default/files/icon_facebook.jpg

Are the image URLs just hard-coded by the wysiwyg including the wrong base path? 图片网址是否只是由所见即所得硬编码的,包括错误的基本路径? Is there something I can do to make them work? 我可以做些什么使它们工作吗?

When you're using wysiwyg, the image path is saved along with the rest of the HTML, and the filters don't convert it. 当您使用所见即所得时,图像路径会与其他HTML一起保存,并且过滤器不会对其进行转换。 So under some conditions - especially if you're moving from a subdirectory to the HTML root - you'll have images that are misplaced. 因此,在某些情况下-尤其是当您从子目录移动到HTML根目录时-图片会放错位置。

The pathologic module might be of some help here. 此处的病理模块可能会有所帮助。 Otherwise you could use Views Bulk Operations to do a string_replace() operation your HTML fields. 否则,您可以使用Views Bulk Operations对HTML字段执行string_replace()操作。

Try setting the $base_url in sites/default/settings.php. 尝试在sites / default / settings.php中设置$ base_url。 I'm not sure how the WYSIWYG is setting images, but it's pretty standard that it should be using a path relative to the base url. 我不确定所见即所得如何设置图像,但是按标准使用相对于基本URL的路径是相当标准的。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM