ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Resize inline images within entries with img_sizer

September 23, 2010 1:46pm

Subscribe [6]
  • #1 / Sep 23, 2010 1:46pm

    Cyborg

    22 posts

    Hi,

    I have a bunch of inline image.jpg that are inserted into my entries.

    These images are uploaded to the filemanager originally in high resolution since they’re used in other parts of the site, and it’s easier to maintain just one file and then get it resized across different pages with img_sizer.

    My question is: is there a possibility to resize that images inside that entry with img_sizer automatically?

  • #2 / Sep 23, 2010 2:56pm

    Jamie Poitra

    409 posts

    Not with the default mechanisms available to img_sizer.

    I’m imagining if you hacked it quite a bit with some fancy regex stuff to find the images you could make it work.

    Jamie

  • #3 / Sep 24, 2010 5:08am

    Cyborg

    22 posts

    Thanks Jamie.

    Has nobody reading this ever implemented a solution like this? Is there not any plugin that can be used to identify the tag and then just img_sizer it?

  • #4 / Sep 24, 2010 10:40am

    hd 

    156 posts

    I have not looked lately, but perhaps there is a WYSIWYG editor with similar functionality?

    I’m actually coding one for an upcoming project, so far it does not work in webkit browsers as I’d like. I’ll be sure to put it on devot-ee when it’s up to standards (probably 3-5 wks).

    In the meantime you could handle this with some regex action as Jamie suggests with php (on the output stage). The problem with this method is that it will occur after the rendering of the page and you cannot simply replace the image tags with EE for imgsizer, so you may have to use a more traditional image-sizer or one that allows you to specify dimensions in GET variables.

    Something like: (pseudo code)

    <?php ob_start(); ?>
    
    Insert your exp:channel:entries loop here
    
    <?php $haystack = ob_get_contents();
    ob_end_clean(); 
    
    echo preg_replace('/(img|src)("|'|="|=')(.*)/i',"/imgrenderer.php?image=$3&height=100&width=100",$haystack);
    ?>
  • #5 / Sep 24, 2010 10:59am

    Cyborg

    22 posts

    Thanks a lot hd.

    I’ll be looking forward to that extension. It’d be great if you could reply to the topic when you get it out of the kitchen.

    In the meantime I’ll have a play with the code you posted.

  • #6 / Nov 19, 2010 9:17pm

    lukemcr

    154 posts

    Any luck, Cyborg? What did you end up doing? In EE 1.6 I ended up hacking some of the core EE files to insert imgsizer tags in there, but I’m not sure I can do that w/ EE2.

  • #7 / Nov 22, 2010 4:52am

    Cyborg

    22 posts

    In the end I couldn’t do it Likemcr :-( 

    Sorry can’t help, I hope somebody soon can help on this.

  • #8 / Jun 15, 2011 12:10am

    Cem Meric

    210 posts

    You need something like Img Tag Modifier. Have a look how it’s implemented in my post back in EE1. I did convert it to EE2 as well some time ago. Let me know if you need it.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases