Skip to content

Commit

Permalink
Fix images size
Browse files Browse the repository at this point in the history
  • Loading branch information
giokalm committed Jul 26, 2019
1 parent cdf6a86 commit e5198ea
Show file tree
Hide file tree
Showing 15 changed files with 84 additions and 84 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
/public/storage
/storage/*.key
/vendor
/public/images/profiles
/public/images/posts
.env
.env.backup
.phpunit.result.cache
Expand Down
6 changes: 5 additions & 1 deletion app/Http/Controllers/PostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Storage;



class PostController extends Controller
{
Expand Down Expand Up @@ -54,7 +57,7 @@ public function store()



Input::file('path')->move(public_path('images'), $imageName);
Input::file('path')->move(public_path('images/posts'), $imageName);

$attributes['path'] = $imageName;

Expand All @@ -77,6 +80,7 @@ public function update(Post $post)

public function destroy(Post $post)
{
Storage::delete($post->path);
$post->delete();
return redirect('/posts');
}
Expand Down
90 changes: 49 additions & 41 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function up()
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->text('moto')->nullable();
$table->string('avatar')->default('default.png');
$table->string('avatar')->nullable();
$table->rememberToken();
$table->timestamps();
});
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"cross-env": "^5.1",
"jquery": "^3.2",
"laravel-mix": "^4.0.7",
"lodash": "^4.17.5",
"lodash": "^4.17.15",
"popper.js": "^1.12",
"resolve-url-loader": "^2.3.1",
"sass": "^1.15.2",
Expand Down
File renamed without changes
7 changes: 5 additions & 2 deletions resources/views/common/nav.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@
<li class="nav-item {{ Request::path() == '/profile' ? 'active' : '' }} mr-2">

<a href="/profile/{{ Auth()->id() }}">

<img src="/images/profiles/{{Auth()->user()->avatar}}" alt="" class="avatar nav-mobile">
@if(Auth()->user()->avatar === null)
<img src="/images/static/default.png" alt="profile_pic_{{Auth()->user()->name}}" class="avatar nav-mobile">
@else
<img src="/images/profiles/{{Auth()->user()->avatar}}" alt="profile_pic_{{Auth()->user()->name}}" class="avatar nav-mobile">
@endif
<span class="nav-pc">My profile</span>
</a>

Expand Down
5 changes: 3 additions & 2 deletions resources/views/posts/edit.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@extends('layouts.app')

@section('content')

<div class="container">
<h1 class="text-center">Edit this post</h1>

<br>
Expand All @@ -11,7 +11,7 @@
<div class="form-row">
<div class="col-md-6">

<img src="/images/{{$post->path}}" alt="..." class="rounded img-thumbnail" >
<img src="/images/posts/{{$post->path}}" alt="..." class="rounded img-thumbnail" >



Expand All @@ -34,4 +34,5 @@
</div>
<a href="{{ url()->previous() }}" class="text-muted">Back</a>
</form>
</div>
@endsection
2 changes: 1 addition & 1 deletion resources/views/posts/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@foreach ($posts as $p)
<div class="card border-white">
<a href="/posts/{{ $p->id }}" >
<img class="card-img-top rounded-conrners preview" src="/images/{{ $p->path }}" alt="alt">
<img class="card-img-top rounded-conrners preview" src="/images/posts/{{ $p->path }}" alt="alt">
</a>
<div class="card-footer d-flex justify-content-between" style="background-color: transparent; border-top : none;">
<!-- <a href="/posts/{{ $p->id }}" >{{ $p->title }}</a> -->
Expand Down
Loading

0 comments on commit e5198ea

Please sign in to comment.