I am implemented the uploaded images are displayed on the site . For
the image not uploaded correctly means i replace the error-image on
that? When i load the site I am facing the issue error image not
define
, and for the lightbox is loading in both chrome and firefox
but its not loading in IE, displaying only the black background.
Here is my code for displaying the error image and uploading image
from the webservices.
Php Code :
foreach(object_2_array($ans->answerDocumentList) as $document){
if ($document->documentHttpUrl!= ''):
$document_name_explode = explode('.',$document->documentName);
$file_type = trim($document_name_explode[1]);?>
<div class="documentation_class" <?php if($k%2==0){?> style="float:none;margin-left:0px;" <?php }else{ ?> style="float:left;"<?php } ?>>
<?php if(($file_type!="") &&($file_type=="png" || $file_type=="jpg" || $file_type=="jpeg" || $file_type=="gif")){ ?>
<a rel="lightbox[document]" href="<?php echo stripcslashes($document->documentHttpUrl); ?>">
<img alt="<?php echo stripcslashes($document->documentName); ?>" src="<?php echo APP_FORUM_URL;?>/images/ajax-load.gif" dataimage="<?php echo stripcslashes($document->documentHttpUrl); ?>" class="document_image" style="max-width:644px !important;" onerror='errorImage("<?php echo RESOURCE_URL_BASE;?>",this);' border="0" />
</a>
<br/>
<?php } else{
echo $document->documentName;
} ?>
<div class="question_float_left download_link">
<a href="<?php echo stripcslashes($document->documentHttpUrl); ?>">Click here to download this file</a>
</div>
<?php endif; ?>
<input type="hidden" value="<?php echo $document->documentId; ?>" class="list_document_id"/>
<input type="hidden" value="<?php echo $document->documentName; ?>" class="list_document_title"/>
</div>
<?php $k++; }?>
<script>
Function is:
function errorImage(url,ctrl){
ctrl.style.border='solid 1px black';
ctrl.src='<?php echo APP_FORUM_URL; ?>images/broken-image.jpg';
$(ctrl).parent().parent().find('.download_link').hide();
}