Laravel-filemanager: click on thumbnail open image in new window

Created on 10 Oct 2017  路  15Comments  路  Source: UniSharp/laravel-filemanager

OS System & Version: Linux dev2 4.4.44-1-pve #1 SMP PVE 4.4.44-84 (Thu, 9 Mar 2017 12:06:34 +0100) x86_64
Laravel Version: v5.5.11
File Manager Version: v1.8.1
imagick Extension: Not Install
gd Extension: Install

I can upload resize, crop but when i try to select image for editor it open in new tab instead to select in editor.

WIP bug

Most helpful comment

to fix when u click on images then open "view file" :

  1. open resources/views/vendor/laravel-filemanager/grid-view.blade.php
  2. and change onlick = "viewFile" to onclick = "useFile"
    before
<div class="square clickable {{ $item->is_file ? '' : 'folder-item' }}" data-id="{{ $item_path }}"
           @if($item->is_file && $thumb_src) onclick="viewFile('{{ $item_path }}', '{{ $item->updated }}')"
           @elseif($item->is_file) onclick="download('{{ $item_name }}')" @endif >
      @if($thumb_src)
      <img src="{{ $thumb_src }}">
      @else
      <i class="fa {{ $item->icon }} fa-5x"></i>
      @endif
    </div>
after
<div class="square clickable {{ $item->is_file ? '' : 'folder-item' }}" data-id="{{ $item_path }}"
           @if($item->is_file && $thumb_src) onclick="useFile'{{ $item_path }}', '{{ $item->updated }}')"
           @elseif($item->is_file) onclick="download('{{ $item_name }}')" @endif >
      @if($thumb_src)
      <img src="{{ $thumb_src }}">
      @else
      <i class="fa {{ $item->icon }} fa-5x"></i>
      @endif
    </div>

this work for me

All 15 comments

@eduardduta Were you integrating this package with WYSIWYG editor? Or with standalone button?

i use tinyMCE

@eduardduta Could you solve the problem?

not yet. the problem still persist.

@eduardduta do you have any error from your console?

No, that was first thing that i checked.

Getting the exact same issue, i've tried with TinyMCE, Summernote, CKE and standalone button.
File manager opens fine, images upload fine, resize and crop all works nicely but as soon as i click on an image to select it, it just opens a new window "view file" with the image and nothing else.

No idea what's going on. Tried in multiple projects and same thing each time.

No errors, no nothing.

Windows
using localhost (127.0.0.01:8000)
Laravel 5.5
latest version of file manager

I have the same problem ,I use tinyMCE

to fix when u click on images then open "view file" :

  1. open resources/views/vendor/laravel-filemanager/grid-view.blade.php
  2. and change onlick = "viewFile" to onclick = "useFile"
    before
<div class="square clickable {{ $item->is_file ? '' : 'folder-item' }}" data-id="{{ $item_path }}"
           @if($item->is_file && $thumb_src) onclick="viewFile('{{ $item_path }}', '{{ $item->updated }}')"
           @elseif($item->is_file) onclick="download('{{ $item_name }}')" @endif >
      @if($thumb_src)
      <img src="{{ $thumb_src }}">
      @else
      <i class="fa {{ $item->icon }} fa-5x"></i>
      @endif
    </div>
after
<div class="square clickable {{ $item->is_file ? '' : 'folder-item' }}" data-id="{{ $item_path }}"
           @if($item->is_file && $thumb_src) onclick="useFile'{{ $item_path }}', '{{ $item->updated }}')"
           @elseif($item->is_file) onclick="download('{{ $item_name }}')" @endif >
      @if($thumb_src)
      <img src="{{ $thumb_src }}">
      @else
      <i class="fa {{ $item->icon }} fa-5x"></i>
      @endif
    </div>

this work for me

yes, and work for me too ... thanks @webkkopsse

Views are refactored in v2.0.0-alpha.

Have the same issue, but in "vendor/unisharp/....../views/grid-view.blade.php"

<div class="square clickable {{ $item->is_file ? '' : 'folder-item' }}" data-text="testHere" data-id="{{ $item_path }}"
       @if($item->is_file && $thumb_src) onclick="**useFile**('{{ $item_path }}', '{{ $item->updated }}')"
       @elseif($item->is_file) onclick="download('{{ $item_name }}')" @endif >
  @if($thumb_src)
  <img src="{{ $thumb_src }}">
  @else
  <i class="fa {{ $item->icon }} fa-5x"></i>
  @endif
</div>

Allready this function - useFile().

And when i click to insert img link it open a new window with img preview...

Who can help?

@Lunberg88 Do you also have that same file in resources/views/vendor/laravel-filemanager/? If so Laravel will use that one and override any changes you make to this file vendor/unisharp/....../views/grid-view.blade.php for reference see: "Overriding Package Views" https://laravel.com/docs/5.1/packages

@Lunberg88 Also remove those ** around useFile if that is your actual code.

@paulkn
Thanks, but there is no such dir in resources, only css & js.
Also in vendor dir, in view file the code is clean and without (**).
onclick="useFile('{{ $item_path }}', '{{ $item->updated }}')"
So, if u have any idea's, it would be nice :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DaxtonChen picture DaxtonChen  路  4Comments

farshidrezaei picture farshidrezaei  路  4Comments

phamtien9819 picture phamtien9819  路  5Comments

farshidahmadianpin picture farshidahmadianpin  路  3Comments

sanvu88 picture sanvu88  路  3Comments