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

Resize Images in gallery

Discussion in 'Media Gallery Support' started by Nuno, Jun 14, 2015.

  1. Nuno

    Nuno Active Member


    I would like to batch resize images and quality in the gallery.
    Usually we could do it with Image Magic mogrify but since attachments are all *.data, its not safe to do it since we could be resizing a pdf or text file.

    Is there a way of doing this safely?

  2. Chris D

    Chris D XenForo Developer Staff Member

    There are no batch image resize functions.

    You can set maximum image width and height in Options. Any new images being uploaded after that will be resized if they exceed the dimensions specified, but there is no way to do it retrospectively.

    It is not impossible to do it with custom development or scripts. It just involves looping through all of the xf_attachment and xf_attachment_data records targeting the attachments with a content type of 'xengallery_media'. The associated records in xf_attachment_data will lead you to the file name of the files themselves.

    I wouldn't normally go into much detail with custom development but I know from the script you sent me that this might be something you can do quite easily.

    Sorry I haven't looked at that yet, by the way, very busy at the moment. Hope you get it sorted.
    Nuno likes this.
  3. Nuno

    Nuno Active Member

    Hi Chris,

    Thanks for you help.
    So, when we import images does it get the information (size / width / height ) from IPB database or it generates those from the file it self?
    If the last is true, I can resize them before move it to xfmg, otherwise, I can make a simple script for this too.

    No problem, I can switch to xf and replace those tags later.
  4. Chris D

    Chris D XenForo Developer Staff Member

    Yeah we ascertain the width / height and file size during import so no worries there.
    Nuno likes this.

Share This Page