On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Hi there,

    I'm using imageslim to resize and add a watermark to images which are placed in the content field of a page (Like this:
    [[*content:imageSlim=`phpthumbof=fltr[]=wmi|/images/watermark.png|BR|100|&q=80`]]
    


    Unfortunately also the animated gif's are being processed, and loses their animation. My question is; is there a way to tell phpthumb (phpthumbof, pthumb, pthumbsup, any will do) to ignore/skip certain files, like gif's, like &skip=`gif`? Anyone ever made something before?

    Thanks for any help!

    MODX 2.3.3

    This question has been answered by michelle84. See the first response.

    • You might want to see: http://stackoverflow.com/questions/1365818/resize-animated-gifs-with-phpthumb

      If you are using GD it will kill the animation, but imagemagick will handle it properly.
        Patrick | Server Wrangler
        About Me: Website | TweetsMODX Hosting
      • discuss.answer
        Thanks! That could be a solution but I worked out something else, because I wanted the entire image to be skipped (also not get the watermark).

        I changed Imageslim a little bit to be able to skip certain images. First I added a class called 'skip' to the editor. The user can set this class for images that shouldn't get the watermark.

        In the snippet Imageslim around line 84 I added the following:

        right after:

        foreach ($dom->getElementsByTagName('img') as $node) {  // for all our images
        

        add:

        	// skip images with class 'skip'
        	$skip = $node->getAttribute('class');
        	if ( ($skip) && ($skip == 'skip') ) {
        		continue;
        	}


        This way the images with class 'skip' get skipped smiley