'download blob image from database can not be open in php mysql

when download image image is can't open .it just 4kb file.please help. image type is in blob.its downloading file.but can't visible.

 <?php
                    if(isset($_GET['task_id'])){
                    $id = $_GET['task_id'];

                        $sql =  "SELECT * FROM workload WHERE TID = $id ";
                        $info =  $obj_admin->manage_all_info($sql);
                   
                        $num_row = $info->rowCount();
                        if($num_row>0){
                            $i=0;
                          }
                          while( $row = $info->fetch(PDO::FETCH_ASSOC) ){

$image = 'images_uploaded/'. $row['imageA'];

                          header("Content-type: image/jpeg");
                          header('Content-Disposition: attachment; filename="table_with_image_image'.$id.'.jpg"');
                          header("Content-Transfer-Encoding: binary"); 
                          header('Expires: 0');
                          header('Pragma: no-cache');
                          header("Content-Length: ".strlen($image));
                          
                          echo $image;
                          exit();
                          
                        }

                      }
                         

?>



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source