<?php
	if(isset($images)){
		$image_type = array('image/jpeg','image/jpg','image/png','image/x-png', 'image/svg+xml');
		$video_type = array('video/mp4');
		$doc_type   = array('application/msword','application/pdf');
		$audio_type = array('audio/mp3','audio/ogg','audio/mpeg');
		$zip_type = array('application/x-zip');

		$col = "col-md-2";
		if(isset($column)){
			if($column == 6){
				$col = "col-md-6";
			}
		}

		foreach ($images as $key => $value) {
			$type =  get_mime_by_extension($value);
			if(in_array($type, $image_type)){
				
?>

					<div id="sort_<?php echo $id[$key]; ?>" class="<?php echo $col; ?> col-xs-3 img-box ui-sortable-handle">
						<div class="thumbnail" title="drag">

                            <label class="image-checkbox">
					            <img class="img-responsive" src="<?php echo $value; ?>" data-url="<?php echo $value; ?>" alt="">
					            <input type="checkbox" class="hidden_input hc_media" name="image[]" value="<?php echo $id[$key]; ?>">
					            <i class="fa fa-check hidden"></i>
					        </label>

					        <input type="hidden" class="selected_media_ids" value="<?php echo $id[$key]; ?>" />
							<span class="remove-icon" title="Remove" onclick="remove_media('<?php echo $id[$key]; ?>')">Remove</span>
						</div>
						<p style="font-size: 11px;" title="<?php echo pathinfo($value)["basename"]; ?>"><?php echo mb_strimwidth(pathinfo($value)["basename"], 0, 25, '...') ; ?></p>
						
					</div>
<?php
			}else if(in_array($type, $doc_type)){
?>
					<div id="sort_<?php echo $id[$key]; ?>" class="<?php echo $col; ?> col-xs-3 img-box ui-sortable-handle">
						<div class="thumbnail image-checkbox" title="drag">
							<label class="image-checkbox">
					            <img src="<?php echo base_url('assets/images/pdf.svg'); ?>" data-url="<?php echo $value; ?>" class="img-responsive">
					            <input type="checkbox" class="hidden_input hc_media" name="image[]" value="<?php echo $id[$key]; ?>">
					            <i class="fa fa-check hidden"></i>
					        </label>
					        <input type="hidden" class="selected_media_ids" value="<?php echo $id[$key]; ?>" />
							<span class="remove-icon" title="Remove" onclick="remove_media('<?php echo $id[$key]; ?>')">Remove</span>
						</div>
						<p style="font-size: 11px;" title="<?php echo pathinfo($value)["basename"]; ?>"><?php echo mb_strimwidth(pathinfo($value)["basename"], 0, 25, '...') ; ?></p>
						
					</div>
<?php
			}else if(in_array($type, $zip_type)){
?>
					<div id="sort_<?php echo $id[$key]; ?>" class="<?php echo $col; ?> col-xs-3 img-box ui-sortable-handle">
						<div class="thumbnail image-checkbox" title="drag">
							<label class="image-checkbox">
					            <img src="<?php echo base_url('assets/images/zip.png'); ?>" data-url="<?php echo $value; ?>" class="img-responsive">
					            <input type="checkbox" class="hidden_input hc_media" name="image[]" value="<?php echo $id[$key]; ?>">
					            <i class="fa fa-check hidden"></i>
					        </label>
					        <input type="hidden" class="selected_media_ids" value="<?php echo $id[$key]; ?>" />
							<span class="remove-icon" title="Remove" onclick="remove_media('<?php echo $id[$key]; ?>')">Remove</span>
						</div>
						<p style="font-size: 11px;" title="<?php echo pathinfo($value)["basename"]; ?>"><?php echo mb_strimwidth(pathinfo($value)["basename"], 0, 25, '...') ; ?></p>
						
					</div>
<?php
			}else if(in_array($type, $video_type)){
?>
					<div id="sort_<?php echo $id[$key]; ?>" class="<?php echo $col; ?> col-xs-3 img-box ui-sortable-handle">
						<div class="thumbnail image-checkbox" title="drag">
							<label class="image-checkbox">
					            <img src="<?php echo base_url().'assets/images/video.png'; ?>" data-url="<?php echo $value; ?>" class="img-responsive">
					            <input type="checkbox" class="hidden_input hc_media" name="image[]" value="<?php echo $id[$key]; ?>">
					            <i class="fa fa-check hidden"></i>
					        </label>
					        <input type="hidden" class="selected_media_ids" value="<?php echo $id[$key]; ?>" />
							<span class="remove-icon" title="Remove" onclick="remove_media('<?php echo $id[$key]; ?>')">Remove</span>
						</div>
						<p style="font-size: 11px;" title="<?php echo pathinfo($value)["basename"]; ?>"><?php echo mb_strimwidth(pathinfo($value)["basename"], 0, 25, '...') ; ?></p>
						
					</div>
<?php
			}else{
?>
					<div id="sort_<?php echo $id[$key]; ?>" class="<?php echo $col; ?> col-xs-3 img-box ui-sortable-handle">
						<div class="thumbnail image-checkbox" title="drag">
							<label class="image-checkbox">
					            <img src="<?php echo $value; ?>" data-url="<?php echo $value; ?>" class="img-responsive">
					            <input type="checkbox" class="hidden_input hc_media" name="image[]" value="<?php echo $id[$key]; ?>">
					            <i class="fa fa-check hidden"></i>
					        </label>
					        <input type="hidden" class="selected_media_ids" value="<?php echo $id[$key]; ?>" />
							<span class="remove-icon" title="Remove" onclick="remove_media('<?php echo $id[$key]; ?>')">Remove</span>
						</div>
						<p style="font-size: 11px;" title="<?php echo pathinfo($value)["basename"]; ?>"><?php echo mb_strimwidth(pathinfo($value)["basename"], 0, 25, '...') ; ?></p>
						
					</div>
<?php
			}
		}
	}
?>