Yii2-php background how to browse the front Save pictures?

Source: Internet
Author: User
The yii2 I used is an article site. All the images in the published articles are saved at the relative address. In frontendweb, the background needs to see the picture to review the article, however, the relative address is found under backendweb. Is there any idea to browse the foreground images in the background? Ps: said before... the yii2 I used is an article site. All the pictures in the published articles are saved with relative addresses. In frontend/web, the background must view the pictures to review the articles, however, the relative address is found under backend/web. Is there any idea to browse the foreground images in the background?

Ps: I am not very clear about what I mentioned earlier. I used a relative address to store the data in the database, for example, upload/images/1.jpg. the address for reading is www.xxx.com/upload/images/1.jpg, which is the frontend. After the backend reads backend.xxx.com/upload/images/1.jpg, the address is incorrect. The image is embedded in the article, and the backend display is difficult for me to change the src address. I don't know what to do.

Reply content:

The yii2 I used is an article site. All the pictures in the published articles are saved with relative addresses. In frontend/web, the background must view the pictures to review the articles, however, the relative address is found under backend/web. Is there any idea to browse the foreground images in the background?

Ps: I am not very clear about what I mentioned earlier. I used a relative address to store the data in the database, for example, upload/images/1.jpg. the address for reading is www.xxx.com/upload/images/1.jpg, which is the frontend. After the backend reads backend.xxx.com/upload/images/1.jpg, the address is incorrect. The image is embedded in the article, and the backend display is difficult for me to change the src address. I don't know what to do.

-. -The database reads upload/images/1.jpg and manually adds the full address to it.

What does it mean? How can I find another address with a relative address?

Store image data into the database when publishing an article

Then, read the database in the background and list the images.

During the upload, save the image in a location, get the location, and write it to the database.
When displayed in the background, get the corresponding data and write it in the img tag.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.