dpmpa26468 2019-06-20 16:18
浏览 115

Wordpress REST API - 图像未显示

I want to display a IMG through the Wordpress REST API. I got the image url successfully, however it won't display. I assumed it was due to CORS headers, but that does not seem to be the case.

I got my file saved on: http://localhost:63342/testsite/index.html

<img src="{{ image.url }}" />
//compiled through handlebars.js ends up like this on the page:
<img src="http://restapi.local/wp-content/uploads/.../image.jpg" />

The response header looks like this, so there doesn't seem to be a CORS error, if i'm not mistaken:

Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Authorization, Content-Type
Access-Control-Allow-Methods: OPTIONS, GET, POST, PUT, PATCH, DELETE
Access-Control-Allow-Origin: http://localhost:63342
Access-Control-Expose-Headers: X-WP-Total, X-WP-TotalPages

adding the URL directly, didn't solve the issue.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 ads仿真结果在圆图上是怎么读数的
    • ¥20 Cotex M3的调试和程序执行方式是什么样的?
    • ¥20 java项目连接sqlserver时报ssl相关错误
    • ¥15 一道python难题3
    • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
    • ¥15 牛顿斯科特系数表表示
    • ¥15 arduino 步进电机
    • ¥20 程序进入HardFault_Handler
    • ¥15 oracle集群安装出bug
    • ¥15 关于#python#的问题:自动化测试