doubeng3216 2015-08-15 21:43
浏览 225
已采纳

HTTP请求失败! 找不到HTTP / 1.1 404

I have imported my site from a local to a live server and this error has come up for only 4 of my images and it worked perfect on the local server.

Warning: getimagesize(http://localhost/theshavingsaloonNEW/wp-content/uploads/2015/08/step1.jpg) [function.getimagesize]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /nfs/c11/h03/mnt/206312/domains/theshavingsaloon.com/html/wp-content/plugins/wr-pagebuilder/shortcodes/image/image.php on line 223

Here is the if statement around line 223 if it helps

if ($image_file) {
    $image_id = WR_Pb_Helper_Functions::get_image_id($image_file);
    $attachment = wp_prepare_attachment_for_js( $image_id );
    $image_file = (!empty( $attachment['sizes'][$image_size]['url'])) ? $attachment['sizes'][$image_size]['url'] : $image_file;
    $data = getimagesize( $image_file );
    $width = $data[0];
    $height = $data[1];
    $html_elemments .= "<img width='{$width}' height='{$height}' src='{$image_file}'{$alt_text}{$class_img} />";
    $script = '';
    $target = '';
}
  • 写回答

3条回答 默认 最新

  • duanqian3464 2015-08-15 22:33
    关注
    http://localhost/theshavingsaloonNEW
    

    this is a localhost url rather than a production one. Try these options in order to solve:

    1. update wp address urls in the admin dashboard -> settings -> general, there are two to change.

    2. Perform a sqldump of the db and use a text editor to replace localhost with your domain and then re-upload.

    3. Download the current theme folder / child theme if you have custom templates or made the theme yourself and use a text editor to find any instances of http://localhost. Replace with get_site_url()./restofurl

    4. In future use a migrate plugin to make this easy, it will do the db work for you.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 eda:门禁系统设计
  • ¥50 如何使用js去调用vscode-js-debugger的方法去调试网页
  • ¥15 376.1电表主站通信协议下发指令全被否认问题
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥15 复杂网络,变滞后传递熵,FDA
  • ¥20 csv格式数据集预处理及模型选择
  • ¥15 部分网页页面无法显示!
  • ¥15 怎样解决power bi 中设置管理聚合,详细信息表和详细信息列显示灰色,而不能选择相应的内容呢?
  • ¥15 QTOF MSE数据分析
  • ¥15 平板录音机录音问题解决