PHP: How to display a default Image if the specified one doesn't exists?

前端 未结 6 1994
不知归路
不知归路 2021-02-06 19:25

I am working on a little project and I need to display the author\'s image for each author in my database. peep the code below:

--THE QUERY--

         


        
6条回答
  •  青春惊慌失措
    2021-02-06 20:16

    try

    if ( !file_exists( 'images/artists/' . $filename ) ) {
       $artist_name = 'holderthumbnail';
    }
    

    have holderthumbnail.jpg in your 'artists' directory

提交回复
热议问题