1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Has anyone implemented server side image resizing for Xenforo?

Discussion in 'XenForo Questions and Support' started by TrevC, Nov 28, 2012.

  1. TrevC

    TrevC Well-Known Member

    As the title states, I really wish Xenforo included some server-side image resizing features. I don't see CSS resizing + file upload limits as being very practical or user-friendly. Has anyone ever implemented a solution to this problem?

    Ideally, we could keep an upload limit of something larger(like 10-15mb per file), preventing the unfriendly file-size error messages when visitors upload photos. Xenforo would then use some PHP/graphics library magic for resizing to a specific max-width/length.

    I realise this could easily eat up a good chunk of server memory and CPU time. However, I think it's worth it considering the benefits.
    erich37 and DBA like this.
  2. ManOnDaMoon

    ManOnDaMoon Well-Known Member

    XenForo already resizes some images, especially avatars that are saved under 3 different sizes: small 48x48, medium 96x96 & large 192x192.

    But it seems there are limitations on which file size the server can proceed, due to memory issues, see XenForo_Image_Abstract::canResize() :
    pubmic static function canResize($width$height)
    // only resize up to approximately 16MP due to memory issues
    return (($width $height) < 16000000);
    Jake Bunce likes this.
  3. ManOnDaMoon

    ManOnDaMoon Well-Known Member

    Maybe this limit depends on which image library is used. This is an option in ACP > Options > Attachments : "Default Image Processor".
  4. TrevC

    TrevC Well-Known Member

    Thanks for the info. I wonder if anyone has done a mash-up with that function and the existing attachment system.

    RAM isn't much of a concern, we'd much rather add a few more gigs and have server resized images. :)
  5. TrevC

    TrevC Well-Known Member

    We've solved this by re-purposing the Xenforo "thumbnails" function (and hacking templates) to become 1024x1024 contained images in posts, which of course link to the originals. Bingo! seamless server-side image re-sizing. IMO, browser resized images are a very ugly solution when every large image is being scaled client-side.

    We've stress tested it with piles of 5mb images. GD's still happy. It's no problem for a modern Xeon with 2 gigs of memory and RAID SSD's. Post/PHP limits had to be increased somewhere, I'm not sure what our sysadmin did specifically. This solution drastically improves load times and scrolling performance, especially on mobile devices.

    Now, where can we tweak GD settings to strip EXIF data and other options?

    EricS, erich37, ibenick and 1 other person like this.
  6. erich37

    erich37 Well-Known Member

  7. TrevC

    TrevC Well-Known Member

    It is, yes. I'm specifically curious about the Xenforo implementation of GD, and where the settings for it can be tweaked.
  8. erich37

    erich37 Well-Known Member

    boahhhh.... this Editor looks very nice!!!! (y)

    This editor is something special and looks very much user-friendly.
    As with the current XF-editor, the average user is not able to even find the button of how to upload an image.

    Is this XenForo ?
    May I have a look at your website, please ? :)
  9. TrevC

    TrevC Well-Known Member

    Yep, it's Xenforo. Heavily customised (plenty of template hacks and I re-wrote most of the styles).

    Xenforo is a great base, but it has some usability and design issues. I also think the stock styles and most Xenforo themes look fairly old fashioned and unnecessarily cluttered.

    It's getting better every day, but is fairly tedious work.


    ibenick, HWS and erich37 like this.
  10. erich37

    erich37 Well-Known Member

    totally agree.

    Oh, I do remember your OMEGA website. It looks fabulous now and seems to be very easy to use.
  11. Mendo

    Mendo Member

    That's very nice (y)
  12. gektor

    gektor Member

    This is exactly what I need. Do you offer your solution as an extention?

Share This Page