Current File : /home/users/barii/public_html/finansenl.com.pl/wodki/application/views/admin/album_image.php |
<script type="text/javascript">
function remove(id, id_img) {
jConfirm('Czy na pewno chcesz usunać ?', 'Potwierdzenie', function(r) {
if( r == true ) {
$.ajax({
type:"GET",
url:"/admin/album/image/"+id+"/delete/"+id_img,
cache:false,
success:function(rsponse)
{
jAlert('Zdjęcie zostało usunięte!', 'Podsumowanie', function() {
location.href = '/admin/album/image/'+id;
});
}
});
}
});
}
</script>
<?php
$path = "uploads/user/images/";
$valid_formats = array("jpg", "png", "gif", "bmp");
if($_POST)
{
for( $i=0;$i<count($_FILES['photoimg']['tmp_name']);$i++) {
$name = $_FILES['photoimg']['name'][$i];
$size = $_FILES['photoimg']['size'][$i];
if(strlen($name))
{
list($txt, $ext) = explode(".", $name);
if(in_array($ext,$valid_formats) && $size<(1024*1024))
{
$time = time();
$actual_image_name = $time.substr($txt, 5).".".$ext;
$actual_image_thumb_name = "thumb_".$time.substr($txt, 5).".".$ext;
$tmp = $_FILES['photoimg']['tmp_name'][$i];
if(move_uploaded_file($tmp, $path.$actual_image_name))
{
$user_image = ORM::Factory('user_image');
$user_image->name = $actual_image_name;
$user_image->viewed = 0;
$user_image->user_id = $user->id;
$user_image->album_id = $album->id;
$user_image->save();
}
else
echo "Błąd";
}
else
echo "Nieprawidłowy format!";
}
}
header("Location: /account/album");
exit;
}
?>
<script type="text/javascript">
function getSizes(im,obj)
{
var x_axis = obj.x1;
var x2_axis = obj.x2;
var y_axis = obj.y1;
var y2_axis = obj.y2;
var thumb_width = obj.width;
var thumb_height = obj.height;
if(thumb_width > 0)
{
if(confirm("Czy chcesz zapisać ?"))
{
$.ajax({
type:"GET",
url:"/ajax_image.php?t=ajax&img="+$("#image_name").val()+"&w="+thumb_width+"&h="+thumb_height+"&x1="+x_axis+"&y1="+y_axis,
cache:false,
success:function(rsponse)
{
$("#cropimage").hide();
$("#thumbs").html("");
$("#thumbs").html("<img src='<?php echo $path; ?>"+rsponse+"' />");
}
});
}
}
else
alert("Wybierz obszar!");
}
$(document).ready(function () {
$('img#photo').imgAreaSelect({
// aspectRatio: '9:6',
maxHeight: 68,
maxWidth: 96,
movable: true,
onSelectEnd: getSizes
});
});
</script>
<div id="page">
<!-- start message-blue -->
<?php if (isset($message_ok)):?>
<div id="message-blue">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="blue-left"><?php echo $message_ok; ?> </td>
<td class="blue-right"><a class="close-blue"><?php echo HTML::image('static/images/table/icon_close_blue.gif');?></a></td>
</tr>
</table>
</div>
<!-- end message-blue -->
<?php endif;?>
<!-- start message-red -->
<?php if (isset($message)):?>
<div id="message-red">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="red-left">
<?php echo $message;?>
</td>
<td class="red-right"><a class="close-red"><?php echo HTML::image('static_back/images/table/icon_close_red.gif');?></a></td>
</tr>
</table>
</div>
<?php endif;?>
<?php echo Message::render(); ?>
<div id="content">
<div class="main">
<div class="head"><h1>Album <?php echo $album->title; ?></h1></div>
<div id="fileupload">
<form method="post" action="" name="fff" enctype="multipart/form-data">
<fieldset class="register">
<input type="file" name="photoimg[]" id="file" /><br/>
<input type="file" name="photoimg[]" id="file" /><br/>
<input type="file" name="photoimg[]" id="file" /><br/>
<input type="file" name="photoimg[]" id="file" /><br/>
<input type="file" name="photoimg[]" id="file" /><br/>
<input type="file" name="photoimg[]" id="file" /><br/>
<input type="file" name="photoimg[]" id="file" /><br/>
<input type="file" name="photoimg[]" id="file" /><br/>
<input type="file" name="photoimg[]" id="file" /><br/>
<input type="file" name="photoimg[]" id="file" /><br/>
<input type="hidden" name="send" id="image_name" value="ok" />
<br/>
<input type="submit" value="Zapisz"/>
</fieldset>
</form>
</div>
<div style="margin:0 auto; width:600px">
<?php if( !empty($image)) echo $image; ?>
<div id="thumbs" style="padding:5px; width:600px"></div>
</div>
<h2>Dodane zdjęcia</h2><br clear="both"/>
<div class="main_content">
<div id="gallery">
<?php foreach( $images as $image ) : ?>
<span style="float: left;">
<a href="/uploads/user/images/<?php echo $image->name; ?>" rel="group1"><img src="/image.php/image-name.jpg?width=216&height=170&cropratio=21:17&image=//uploads/user/images/<?php echo $image->name; ?>" alt="" class="photo"/></a>
<br/>
<a id="delete" onclick="remove('<?php echo $image->album_id; ?>','<?php echo $image->id; ?>'); return false;" style="padding-left: 20px;" href="#" class="confirm_button"><img src="./static/images/medialni_402.jpg" alt="Usuń" title="Usuń"/></a>
<!--
<?php if( $image->highlight == 0 ) : ?><a id="highlight" href="/admin/album/image/<?php echo $image->album_id; ?>/highlight/<?php echo $image->id; ?>"><img src="./static/images/star.png" alt="Wyróżnij" title="Wyróżnij"/></a><?php endif; ?>
<?php if( $image->highlight == 1 ) : ?><a href="/admin/album/image/<?php echo $image->album_id; ?>/dehighlight/<?php echo $image->id; ?>"><img src="./static/images/destar.png" alt="Zabierz wyróżnienie" title="Zabierz wyróżnienie"/></a><?php endif; ?>
//-->
</span>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
</div>