We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19328
    • 433 Posts
    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
        • 19328
        • 433 Posts
        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