public function makeCrop($id) { $image = $this->model($id); $source = Input::get('source', 'original'); $variant = Input::get('variant', ''); $revariantion = Input::get('revariation', 0); $settings = Input::get('settings', 0); $width = (int) ceil(Input::get('x2') - Input::get('x1')); $height = (int) ceil(Input::get('y2') - Input::get('y1')); $x = (int) ceil(Input::get('x1')); $y = (int) ceil(Input::get('y1')); $img = Img::make($image->file($source)); if ($width && $height) { $img->crop($width, $height, $x, $y); } $img->save($image->file($variant)); if (!$variant && $revariantion) { $image->setFileAttribute($image->file()); $image->save(); } if ($settings) { $image->saveVariant($img, $variant); } $this->result['action'] = 'update'; $this->result['make'] = 'crop'; $this->result['data']['image'] = subdomainImage($image->src($variant) . '?r=' . rand()); return $this->result(); }
<a href="<?php echo subdomainImage($image->src('large')); ?> " rel="prettyPhoto[]"> <img src="<?php echo subdomainImage($image->src('medium')); ?> " alt="<?php echo $image->name; ?> " title="<?php echo $image->name; ?> " class="image" /> </a>
</div> <div class="row"> <div class="col-lg-12"> <?php foreach ($site->childs()->act()->sort()->get() as $k => $child) { $imageSrc = $child->image() ? $child->image()->src('preview') : ''; ?> <div class="col-md-4 col-sm-6 col-xs-6 border"> <div class="boxgrid caption boxgrid-preview center-block"> <a href="<?php echo $child->link(); ?> "> <img src="<?php echo subdomainImage($imageSrc); ?> " alt="<?php echo $child->name; ?> " /> </a> <div class="cover boxcaption"> <h3 class="nowrap"> <a href="<?php echo $child->link(); ?> "><?php echo $child->name; ?> </a>
/assets/images/edit.png"> </a> <a href="<?php echo url('/'); ?> /admin/image/<?php echo $image->id; ?> " class="js-ajax delete"> <img src="<?php echo url('/'); ?> /assets/images/delete.png"> </a> <a href="<?php echo subdomainImage($image->src()); ?> " rel="prettyPhoto[image]" class="zoom"> <img src="<?php echo url('/'); ?> /assets/images/zoom.png"> </a> <div class="full"> <div class="row"> <div class="col-lg-5 pr0"> <div class="form-group-sm"> <label class="sm-label">Название</label> <input type="text" data-name="name" value="<?php echo $image->name; ?>
<?php if (!$variant) { ?> <label><input type="checkbox" name="revariation" value="1" />Применить ко всем вариантам</label> <?php } ?> <div class="inline-labels" style="display: none;"> <label>X1 <input type="text" size="4" name="x1" /></label> <label>Y1 <input type="text" size="4" name="y1" /></label> <label>X2 <input type="text" size="4" name="x2" /></label> <label>Y2 <input type="text" size="4" name="y2" /></label> <label>W <input type="text" size="4" name="w" /></label> <label>H <input type="text" size="4" name="h" /></label> </div> </div> <div class="col-lg-12"> <div class="image-crop"> <img class="target-image-crop" data-id="<?php echo $image->id; ?> " src="<?php echo subdomainImage($image->srcNoCache($variant)); ?> " /> </div> </div> </div>