Jump to content


Photo

Thumbnails of images in TinyMCE


  • Please log in to reply
8 replies to this topic

#1 Nico Knoll

Nico Knoll

    The Boss.

  • Members
  • PipPipPipPipPip
  • 644 posts
  • 235

  • LocationBerlin, Germany

Posted 13 November 2011 - 04:29 PM

Hi,
it would be great if there would be only thumbnails in the TinyMCE image window, so that they load faster and you can have like 4 images in a row.

I guess there are thumbnails automatically after upload, aren't it?

Greets,
Nico

#2 apeisa

apeisa

    Hero Member

  • Moderators
  • 2,526 posts
  • 854

  • LocationVihti, Finland

Posted 13 November 2011 - 05:02 PM

+1 and upcoming image grid would be nice there too.

#3 achabany

achabany

    Jr. Member

  • Members
  • PipPip
  • 13 posts
  • 2

  • LocationMorocco

Posted 06 February 2012 - 10:53 PM

+1

#4 nikola

nikola

    Sr. Member

  • Members
  • PipPipPipPip
  • 224 posts
  • 81

  • LocationZagreb, Croatia

Posted 07 February 2012 - 08:31 AM

+1

Nice suggestion Nico. It would be quite useful when having lots of images on one page for instance...
Check out my ProcessWire admin themes: Futura Remixed Admin Theme / Moderna Admin Theme / Futura Admin Theme

#5 ryan

ryan

    Hero Member

  • Administrators
  • 5,773 posts
  • 3120

  • LocationAtlanta, GA

Posted 07 February 2012 - 01:12 PM

I can see using a browser resize where a max width or height is specified, but am not so sure if it's good to have ProcessWire going and creating multiple new thumbnail files just so they can be selected in the admin. Perhaps a good balance would be to display the ones with thumbnails where the 'admin thumbnails' option is selected with the image field, and just use the same thumbnail.

#6 Pete

Pete

    Administrator

  • Administrators
  • 1,756 posts
  • 658

  • LocationChester, England

Posted 08 February 2012 - 02:27 AM

I think that'd be the way to do it Ryan - it covers every website I've done so far as they all have admin thumbnails turned on.

Obviously other people's scenarios will vary but that would cater for the majority I think.

#7 ryan

ryan

    Hero Member

  • Administrators
  • 5,773 posts
  • 3120

  • LocationAtlanta, GA

Posted 08 February 2012 - 10:13 AM

Okay I will plan to make this update.

#8 achabany

achabany

    Jr. Member

  • Members
  • PipPip
  • 13 posts
  • 2

  • LocationMorocco

Posted 10 February 2012 - 09:17 PM

Here is my hack to do such thing easily :

I edited the ProcessPageEditImageSelect.module to add two protected vars : $thumbWidth and $thumbHeight and i change the ___execute() function like so :

       	 foreach($images as $image) {
                //$width = $image->width();
                $thumb = $image->size($this->thumbWidth, $this->thumbHeight);

                if($width > $this->maxImageWidth) $width = $this->maxImageWidth;
                $out .= "\n\t<li><a href='./edit?file={$image->basename}&amp;modal=1&amp;id={$this->page->id}&amp;winwidth=$winwidth'>" .
                    "<img src='{$thumb->url}' width='{$this->thumbWidth}' alt=\"{$image->description}\" /></a></li>";
            }

i used the size() function to change the image width and height, to create a thumbnail and instead of using $image->url i use $thumb-url

Just after that, i change my css to make <li> element float in order to get a grid of elements :


#select_images li {


	float: left;
	margin: 0 5px 5px 0;
}

see the attached image for an example of use.

There is just a one problem, if the picture is smaller than the thumbnail width and height, the size function will make a pixelazed version wich isn't good, in such case, the function have to add a blank space to make a correct thumb.

Attached Thumbnails

  • processwire_preview_thumbs.png


#9 ryan

ryan

    Hero Member

  • Administrators
  • 5,773 posts
  • 3120

  • LocationAtlanta, GA

Posted 13 February 2012 - 02:12 PM

Nice work Achabany, this looks great. I will aim to get a similar look with the module.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users