P
P
Pupkin_v12020-09-09 19:32:12
DLE
Pupkin_v1, 2020-09-09 19:32:12

How to add code to display title for images in DLE?

Guys, there is a piece of code that is responsible for displaying the added images in the admin panel when adding news,

$this->image_count ++;

    if( $option[1] != "" ) {

      $alt = htmlspecialchars( strip_tags( stripslashes( $option[1] ) ), ENT_QUOTES, $config['charset'] );
      $alt = str_replace("&","&",$alt);
      
      $info = $info."|".$alt;
      $alt = "alt=\"" . $alt . "\"";

    } else {
      
      if($this->image_count == 1) {
        
        $alt = htmlspecialchars( strip_tags( stripslashes( $_POST['title'] ) ), ENT_QUOTES, $config['charset'] );
        $alt = str_replace("&","&",$alt);
        
      } else { $alt = ""; }
      
      $alt = "alt=\"" . $alt . "\"";

    }

    if ( $align ) {
      
      $style="style=\"float:{$align};max-width:100%;\"";
      
    } else $style="style=\"max-width:100%;\"";
    
    if( intval( $config['tag_img_width'] ) ) {

      if (clean_url( $config['http_home_url'] ) != clean_url ( $url ) ) {
        
        $style .= " data-maxwidth=\"".intval($config['tag_img_width'])."\"";
        
      }
      
    }

    return "<!--dle_image_begin:{$info}-->".$this->htmlparser->purify("<img src=\"{$url}\" {$style} {$alt}>")."<!--dle_image_end-->";

  }


I want to make sure that according to the filled news title {title}, alt and title are automatically filled in images, as I understand it, you need to add something like title=\"{$row['title']}\" alt=\"{$ row['title']} but it doesn't work in this code, please help

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question