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

Resize Images in gallery

Nuno

Active member
#1
Hello,

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?

Thanks
 

Chris D

XenForo developer
Staff member
#2
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

Active member
#3
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.

Sorry I haven't looked at that yet, by the way, very busy at the moment. Hope you get it sorted.
No problem, I can switch to xf and replace those tags later.