Question

I use Elfinder 2.1 and i'm looking for a possibility to get the right thumbnail path of an image with PHP.

By default a .tmb folder exist in every folder and contains the resized thumbnails with an (i think) md5 hashed filename.

How can i retrieve the correct thumbnail for a specific image in PHP? The goal is to show only the thumbnails in another PHP Script and with a click the original imgage shows up.

Was it helpful?

Solution 2

Take a look at this issue, it may point you in the right direction: https://github.com/Studio-42/elFinder/issues/671

OTHER TIPS

Thanks, was useful. I added one thing.

protected function tmbname($stat) {
    $ext = 'png';
    if($stat['mime'] == 'image/jpeg'){$ext = 'jpg';}
    if($stat['mime'] == 'image/gif'){$ext = 'gif';}
    return current(explode('.', $stat['name'])).'.'.$ext;
    //$stat['hash'].$stat['ts'].'.png';
}

Works well and deletes too.

I answered that question just a few minutes ago on the above link. In short:

  1. search for the function tmbname($stat) in the class elFinderVolumeDriver.class.php

  2. replace the return value with this: current(explode('.', $stat['name'])).'.png';

This way the created thumbnails will have the same name as the original image (of course with .png extension). If that will arise security questions/problems, I don't know. Hope it does help.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top