Does html can be use with dynamic generated images in php?

前端 未结 2 815
孤街浪徒
孤街浪徒 2021-01-20 17:56

I am using this code to create an image



        
2条回答
  •  盖世英雄少女心
    2021-01-20 18:34

    Basically, to create dynamic image in HTML, you will need 2 PHP files:

    1. one for the image itself
    2. another one for PHP to display it.

    Let's take a look how to do it:

    1. You create image.php that accept parameter, like: image ID or file name. For security reason, you HAVE to filter whatever parameter it get.

      Why you have to do this? because, to generate image, you can't mix it with another HTML output. Let alone a single space or return as this will render the image broken.

    2. You do the HTML thing on another PHP, say test92.php. To the HTML logic here, like:

      1. get image data
      2. loop the data
      3. display image =>

提交回复
热议问题