I have a PHP page that opens a jQuery dialog like:
$( "#editdialog" ).dialog({
autoOpen: false,
title: 'Show photo',
height: 750,
width:900,
modal:true
});
$( ".editer" ).click(function() {
$( "#editdialog" ).load("photo_view.php");
$( "#editdialog" ).dialog( "open" );
$('.ui-widget-overlay').css('background', 'silver');
});
The load_photo.php
code is the following:
$sql = "SELECT PHOTO FROM USERS WHERE ID='01'";
$result = mysql_query($sql);
if($result==FALSE) die("error".mysql_error());
$row = mysql_fetch_assoc($result);
header("Content-type: image/jpeg");
echo $row['PHOTO'];
If I browse directly to load_photo.php
the image is shown.
If I load the load_photo.php
page inside a dialog, the image is not shown.
It can be an error of the header()
function?
EDIT: I add an intermediate page like your suggestions. Now the dialog loads photo_view.php and its code is:
<img src="load_photo.php" width="75" height="75" style="padding:0px;" class="imageborder" onerror="this.src='noimg.jpg'" accept="image/*" />
Still not working, same result. In the dialog the img box still remain blank, browsing directly to photo_view.php the image is shown.
Thank you!