Tuesday 15 November 2011

Edit Image

Edit image from below


<?php
$upload_data_pic = $arr]['pathofthepicture'];
if($upload_data_pic && $upload_data_pic != '' ) {
$thumbimguser = $this->baseUrl()."/property_images/".$upload_data_pic;  //image path
  ?>
<span style="vertical-align:top" id="thumbimage2"> <img src="<?php echo $thumbimguser;?>" />
<a href="javascript:;" onClick="editImage();" class="comment" style="text-decoration:none;">Edit</a>&nbsp;&nbsp;
// <?php echo formError('upload_file', $this->errors); ?>
               // optional for error shows
</span>

    <span style="vertical-align:top; display:none;" id="editbanner2"><input type="file" name="upload_file" id="upload_file" value="" />&nbsp;&nbsp;<a href="javascript:;" onClick="canceleditImage();" class="comment" style="text-decoration:none;">Cancel</a></span>
<?php } else {?>
              <input type="file" name="upload_file" id="upload_file" />
//<?php echo formError('upload_file', $this->errors); ?>
                               // optional for error
<?php }?>


ALSO PLACE A SCRIPT IN YOUR FILE BELOW/TOP  OF THE PAGE OR IN JS FILE


<SCRIPT type="text/javascript">
function editImage()
{
document.getElementById('thumbimage2').style.display='none';
document.getElementById('editbanner2').style.display='block';
}

function canceleditImage()
{
document.getElementById('upload_file').value='';
document.getElementById('thumbimage2').style.display='block';
document.getElementById('editbanner2').style.display='none';

}
</SCRIPT>








No comments:

Post a Comment