البوم ADMIN | |||
عنوان الالبوم | الصور | آخر صورة | |
<?php ini_set("max_execution_time","4000"); ini_set("max_input_time"
<?php
ini_set("max_execution_time","4000"); ini_set("max_input_time","4000"); ini_set("memory_limit","128M"); $upload_path = "/"; // The path to where the image will be saved $thumb_image_prefix = "Mr.Robot"; // The prefix **** to the thumb image $*****=800; $heigh=550; if ($_SERVER['REQUEST_METHOD'] == 'POST' && !isset($_POST["upload"])) { $targ_w = $*****; $targ_h =$heigh; $jpeg_quality = 100; $src = $upload_path.$_POST["img****"]; list($image*****, $image******, $imageType) = getimagesize($src); $imageType = image_type_to_mime_type($imageType); $dst_r = imagecreatetruecolor( $targ_w, $targ_h ); switch($imageType) { case "image/gif": $img_r=imagecreatefromgif($src); break; case "image/pjpeg": case "image/jpeg": case "image/jpg": $img_r=imagecreatefromjpeg($src); break; case "image/png": case "image/x-png": $img_r=imagecreatefrompng($src); break; } imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],$targ_w,$targ_h,$_POST['w'],$_POST['h']); switch($imageType) { case "image/gif": imagegif($dst_r ,$src); break; case "image/pjpeg": case "image/jpeg": case "image/jpg": imagejpeg($dst_r ,$src,100); break; case "image/png": case "image/x-png": imagepng($dst_r ,$src); break; } echo " <****** ********=**********> opener.********.addnews.pic2.value='".$_POST["img****"]."'; self.close(); </******> "; exit; } if (isset($_POST["upload"])) { $file**** = ********($_FILES['image']['****']); $file_ext = strtolower(substr($file****, strrpos($file****, '.') + 1)); $nome_arquivo = $thumb_image_prefix.time().'.'.$file_ext; move_uploaded_file($_FILES['image']['tmp_****'], $upload_path.$nome_arquivo); header("********:".$_SERVER["PHP_SELF"]."?file****=".$nome_arquivo); exit(); } ?> <!DOCTYPE html> <html lang="en"> <head> <title></title> <**** ***********="*******-type" *******="****/html;charset=UTF-8" /> <****** src="js/jquery.min.js"></******> <****** src="js/jquery.Jcrop.js"></******> <****** type="****/**********"> jQuery(function($){ // Create variables (in this scope) to hold the API and image size var jcrop_api, boundx, boundy, // Grab some information about the preview pane // $preview = $('#preview-pane'), $pcnt = $('#preview-pane .preview-container'), $pimg = $('#preview-pane .preview-container img'), xsize = $pcnt.*****(), ysize = $pcnt.******(); $('#target').Jcrop({ // onChange: updatePreview, onSelect: updatePreview, aspectRatio: <?php echo $*****;?> / <?php echo $heigh;?>, onSelect: updateCoords },function(){ // Use the API to get the real image size var bounds = this.getBounds(); boundx = bounds[0]; boundy = bounds[1]; // Store the API in the jcrop_api variable jcrop_api = this; // Move the preview into the jcrop container for css positioning $preview.appendTo(jcrop_api.ui.holder); }); function updatePreview(c) { if (parseInt(c.w) > 0) { var rx = xsize / c.w; var ry = ysize / c.h; $pimg.css({ *****: Math.round(rx * boundx) + 'px', ******: Math.round(ry * boundy) + 'px', marginLeft: '-' + Math.round(rx * c.x) + 'px', marginTop: '-' + Math.round(ry * c.y) + 'px' }); } }; function updateCoords(c) { $('#x').val(c.x); $('#y').val(c.y); $('#w').val(c.w); $('#h').val(c.h); }; function checkCoords() { if (parseInt($('#w').val())) return true; *****('Please select a crop region then press submit.'); return false; }; }); </******> <link rel="stylesheet" href="demo_files/main.css" type="****/css" /> <link rel="stylesheet" href="demo_files/demos.css" type="****/css" /> <link rel="stylesheet" href="css/jquery.Jcrop.css" type="****/css" /> <style type="****/css"> .jcrop-holder #preview-pane { display: block; top: 10px; right: -280px; padding: 6px; border: 1px rgba(0,0,0,.4) solid; background-color: white; -***kit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; -***kit-box-shadow: 1px 1px 5px 2px rgba(0, 0, 0, 0.2); -moz-box-shadow: 1px 1px 5px 2px rgba(0, 0, 0, 0.2); box-shadow: 1px 1px 5px 2px rgba(0, 0, 0, 0.2); } /* The ********** code will set the aspect ratio of the crop area ****d on the size of the thumbnail preview, specified here */ #preview-pane .preview-container { *****: 581px; ******: 287px; overflow: hidden; } </style> </head> <****> <?php //Only display the ****cript if an image has been uploaded if(count($_GET['file****'])>0){ ?> <div class="container"> <div class="row"> <div class="span12"> <div class="jc-demo-box"> <div class="page-header"> <h1>Aspect Ratio with Preview Pane</h1> </div> <img src="../../upload/img/<?php echo $_GET['file****'];?>" id="target" alt="[Jcrop Example]" /> <div class="clearfix"></div> <form action="" method="post" onSubmit="return checkCoords();"> <input type="hidden" id="x" ****="x" /> <input type="hidden" id="y" ****="y" /> <input type="hidden" id="w" ****="w" /> <input type="hidden" id="h" ****="h" /> <input type="hidden" ****="img****" value="<?php echo $_GET["file****"]; ?>" /> <input type="submit" value="Crop Image" class="btn btn-large btn-inverse" /> </form> </div> </div> </div> </div> <?php } else { ?> <h2>Upload Photo</h2> <form ****="photo" enctype="multipart/form-data" action="<?php echo $_SERVER["PHP_SELF"];?>" method="post"> Photo <input type="file" ****="image" size="30" /> <input type="submit" ****="upload" value="Upload" /> </form> <?php } ?> </****> </html> |
0 | لا يوجد |