PHP GD Library output an image and text content on same page

后端 未结 4 1201
失恋的感觉
失恋的感觉 2021-01-06 11:27

I am trying to output an image to a browser and then output HTML (not directly related to the image) on the same page. Is this possible? I am having a heck of a time figurin

4条回答
  •  没有蜡笔的小新
    2021-01-06 12:10

    Including image in HTML

    See the following question and answers: Base64 Encoding Image.

    You have to can encode your image using base64_encode() and then output it within tag like that:

    
    

    (see this jsfiddle for a proof).

    Generating image in different file

    You can generate image outside of the script that generates HTML. In such case you will need to generate HTML here and set src attribute of tag to the location of the script generating the image. See @Rodin's answer for a slightly more detailed answer regarding this solution.

    Did it work? Do you need any more help?

提交回复
热议问题