Naming Gallery Images
This commit is contained in:
parent
b4f20ded42
commit
c0547d9594
2 changed files with 22 additions and 23 deletions
|
|
@ -56,10 +56,11 @@ class GalleryController extends Controller
|
|||
|
||||
$imagefilename=$image.".jpg";
|
||||
Log::info("Searching displayname for filenamename $imagefilename");
|
||||
$displayname = DB::table('gallery_items')->select('displayname')->where('filename',$imagefilename)->get();
|
||||
Log::info($displayname);
|
||||
$row = DB::table('gallery_items')->select('displayname')->where('filename',$imagefilename)->get();
|
||||
$displayname = sizeof($row) ? $row[0]->displayname : $imagefilename;
|
||||
Log::info("=> $displayname");
|
||||
|
||||
array_push($imagelist, $image);
|
||||
array_push($imagelist, [$image, $displayname] );
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -165,26 +166,24 @@ class GalleryController extends Controller
|
|||
}
|
||||
|
||||
public function name_image(Request $request, $tour_id, $image_name) {
|
||||
$new_image_name = $request->new_image_name;
|
||||
Log::info("GalleryController::name_image for tour $tour_id , current name=$image_name, new name=$new_image_name");
|
||||
$displayname = $request->new_image_name;
|
||||
Log::info("GalleryController::name_image for tour $tour_id , image_name=$image_name, display_name=$displayname");
|
||||
|
||||
|
||||
|
||||
$new_image_name = $new_image_name . ".jpg";
|
||||
|
||||
str_replace($new_image_name, "'" , "");
|
||||
str_replace($new_image_name, '"' , '"');
|
||||
str_replace($new_image_name, '"' , '"');
|
||||
str_replace($new_image_name, '\\' , '/');
|
||||
str_replace($new_image_name, '\r\n' , ' ');
|
||||
str_replace($new_image_name, '\n' , ' ');
|
||||
str_replace($displayname, "'" , "");
|
||||
str_replace($displayname, '"' , '"');
|
||||
str_replace($displayname, '"' , '"');
|
||||
str_replace($displayname, '\\' , '/');
|
||||
str_replace($displayname, '\r\n' , ' ');
|
||||
str_replace($displayname, '\n' , ' ');
|
||||
|
||||
|
||||
DB::table('gallery_items')->where('gallery_id',"=", $tour_id)->where('filename','=',$image_name)->delete();
|
||||
|
||||
DB::table('gallery_items')->insert( [
|
||||
'gallery_id' => $tour_id, 'filename' => $new_image_name
|
||||
'gallery_id' => $tour_id, 'displayname' => $displayname, 'filename' => $image_name
|
||||
]);
|
||||
|
||||
return redirect("/tour/gallery/$tour_id");
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -10,26 +10,26 @@
|
|||
<div class="container text-primary" style="display:flex">
|
||||
<!-- <ul class="list-group offset-2 col-8" style="display:inline"> -->
|
||||
<ul class="list-group offset-2 col-8" style="display:flex; flex-direction: row;">
|
||||
@foreach($imagelist as $image)
|
||||
@foreach($imagelist as $img_tpl) <!-- 0=filename, 1=displayname -->
|
||||
<label style="display:flex; flex-direction: column;">
|
||||
<a style="display: inline;" href="/img_storage/tour-{{$tour_id}}/{{$image}}_gross.jpg" data-lightbox="/img_storage/tour-{{$tour_id}}/{{$image}}_gross.jpg" data-title="{{$image}}">
|
||||
<img class="mt-3 ml-3" src="/img_storage/tour-{{$tour_id}}/{{$image}}.jpg">
|
||||
<a style="display: inline;" href="/img_storage/tour-{{$tour_id}}/{{$img_tpl[0]}}_gross.jpg" data-lightbox="/img_storage/tour-{{$tour_id}}/{{$img_tpl[0]}}_gross.jpg" data-title="{{$img_tpl[1]}}">
|
||||
<img class="mt-3 ml-3" src="/img_storage/tour-{{$tour_id}}/{{$img_tpl[0]}}.jpg">
|
||||
</a>
|
||||
|
||||
@if(Auth::user()->role=="ADMIN")
|
||||
<p>
|
||||
<a id="edit_{{$tour_id}}_{{$image}}" href="#"><label style="display:inline;">🖊</label></a>
|
||||
<a id="edit_{{$tour_id}}_{{$img_tpl[0]}}" href="#"><label style="display:inline;">🖊</label></a>
|
||||
|
||||
<form style="display:inline;background-color: #fff;" class="text-dark" method="post"
|
||||
action="/tour/gallery/{{$tour_id}}/name_image/{{$image}}.jpg" enctype="multipart/form-data">
|
||||
action="/tour/gallery/{{$tour_id}}/name_image/{{$img_tpl[0]}}.jpg" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<input type="hidden" name="tour_id" value="{{ $tour_id }}">
|
||||
<input type="text" name="new_image_name" value="" ">
|
||||
<input type="text" name="new_image_name" value="" >
|
||||
</form>
|
||||
|
||||
|
||||
<a href="/tour/gallery/{{$tour_id}}/delete_image/{{$image}}.jpg" style="color:red;"><span data-toggle="tooltip" title="Löschen">X</a>
|
||||
<a href="/tour/gallery/{{$tour_id}}/delete_image/{{$img_tpl[0]}}.jpg" style="color:red;"><span data-toggle="tooltip" title="Löschen">X</a>
|
||||
</p>
|
||||
@endif
|
||||
</label>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue