static function load() { if (!self::$instance) { self::$instance = new PostImage(); } return self::$instance; }
public function getPhotos() { if (!empty($this->_photos)) { return $this->_photos; } $photos = PostImage::find()->where(['post' => $this->id, 'deleted' => 0])->all(); return $this->_photos = $photos; }
public function postStatus() { $files = Input::file('files'); $in = Input::all(); $post = Post::create(['StudentID' => Auth::user()->StudentID, 'Message' => $in['message']])->id; foreach ($files as $file) { $rules = array('file' => 'required|mimes:png,jpeg,jpg'); $validator = Validator::make(array('file' => $file), $rules); if ($validator->passes()) { $id = Str::random(14); $destinationPath = 'uploads/status/' . Auth::user()->StudentID . '/'; $filename = $id . $file->getClientOriginalName(); $mime_type = $file->getMimeType(); $extension = $file->getClientOriginalExtension(); $upload_success = $file->move('public/' . $destinationPath, $filename); if ($upload_success) { PostImage::create(['StudentID' => Auth::user()->StudentID, 'post_id' => $post, 'image' => $destinationPath . $filename]); } } } return Redirect::to('/')->with('message', 'Successfully posted'); }
if (self::setting('let_facebook_pick_pic_default', 0) == 2) { echo 'checked="checked"'; } ?> /> The global default </label> </div> </td> </tr> </table> <div> <p><b>Global default picture</b></p> <?php PostImage::ui('sharepress', self::OPTION_DEFAULT_PICTURE, null, 640, 640, self::load()->get_default_picture()); ?> </div> <div style="clear:left;"></div> <?php } ?> <?php if (self::unlocked()) { ?> <br /> <h3 class="title">Share Delay</h3> <p>In some instances it may be necessary or deseriable to delay sharing with SharePress until a certain time <em>after</em>