5

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();
    }
mornaner
  • 2,424
  • 2
  • 27
  • 39
  • You're using `stripcslashes` here in a very, very odd way. It, and its cousins `addslashes` and `stripslashes` are a *code smell*. They're often abused where database escaping belongs, but this case is just *weird*. They're doing *nothing* for you here. I expect that you really meant to use [`htmlspecialchars`](http://php.net/htmlspecialchars), as that would be the right thing to use in context. – Charles Dec 14 '12 at 04:10

1 Answers1

1

Finally i Solved my problem , which i make the Lightbox to worked on the both IE 7 and the IE 8,

I include the script file google api http://www.google.com/jsapi and google.load("jquery", "1"); google.load("jquery", "1");

in the Header.php This is problem which conflict my lighbox.js file and other library files , then i removed that script and added the new script Js library https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js

And i changed all my script $ symbol to jQuery now i make the Lightbox to worked , in IE browser and also in all browser