public function saveThumb($thumb) { $root = Config::get('consts.note_root'); $time = time(); ImageService::savePic($root . 'thumb/', $this, $thumb, 'thumb', false, $time, 400, 300); $this->save(); }
public function saveThumbs($thumb, $banner) { $root = Config::get('consts.product_root'); $time = time(); ImageService::savePic($root . 'thumb/', $this, $thumb, 'thumb', true, $time, 600, 338); ImageService::savePic($root . 'banner/', $this, $banner, 'banner', true, $time, 1200, 400); }
public static function saveImage($banner, $file) { $root = Config::get('consts.banner_root'); $uname = time(); ImageService::savePic($root, $banner, $file, 'path', false, $uname, 0, 0); list($width, $height) = getimagesize($banner->path); $banner->width = $width; $banner->height = $height; $banner->save(); }
static function createPhoto($activity, $photo) { $activityPhoto = new ActivityPhoto(); $activityPhoto->product_id = $activity->product_id; $activityPhoto->activity_id = $activity->id; $root = Config::get('consts.activity_root') . $activity->id . '/'; $time = time() . str_random(10); $thumbName = $root . $time . '_thumb.jpg'; ImageService::savePic($root, $activityPhoto, $photo, 'photo', false, $time, 1200, 900); ImageService::createThumb($activityPhoto->photo, $activityPhoto, 'thumb', false, $thumbName, 400, 300); $activityPhoto->save(); }