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 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100