本文整理汇总了PHP中app\Image::addImage方法的典型用法代码示例。如果您正苦于以下问题:PHP Image::addImage方法的具体用法?PHP Image::addImage怎么用?PHP Image::addImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Image
的用法示例。
在下文中一共展示了Image::addImage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(ProductRequest $request)
{
//
$data = $request->all();
if (isset($data['image'])) {
$thumb = $data['image'];
$new = 'pro' . uniqid() . '.' . $thumb->getClientOriginalExtension();
$thumb->move('upload/product', $new);
}
$data['image'] = $new;
$productId = Product::addProduct($data);
$multi_image = Input::file('multi-images');
foreach ($multi_image as $multi) {
# code...
$thumbnail = 'multi' . uniqid() . '.' . $multi->getClientOriginalExtension();
$multi->move('upload/multi-image', $thumbnail);
Image::addImage($productId, $thumbnail);
}
if (Input::get('color') != "") {
$color = Input::get('color');
foreach ($color as $colorId) {
# code...
MapColor::mapColor($colorId, $productId);
}
}
if ($data['other_color'] != "") {
$other = $data['other_color'];
$colorId = Color::addColor($other);
MapColor::mapColor($colorId, $productId);
}
if (Input::get('size') != "") {
$size = Input::get('size');
foreach ($size as $sizeId) {
# code...
MapSize::mapSize($sizeId, $productId);
}
}
if ($data['other_size'] != "") {
$other = $data['other_size'];
$sizeId = Size::addSize($other);
MapSize::mapsize($sizeId, $productId);
}
return redirect('admin/product');
//return "ok";
}