Announcement

Collapse
No announcement yet.

Resize images that are already in the Attachment database

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Resize images that are already in the Attachment database

    Hi guys,

    I made a mistake with our resizing rules for uploaded pictures. Resulting in having large JPG files in our database from 3MB or larger.

    Is there a way to process them with GD or ImageMagick after they are uploaded? The only thing I seem to be able to is to delete them

    Thanks!

  • #2
    If you have command line access, this may work for you.
    Start off by backing up your database just in case.

    Go to admincp > attachments > attachment storage type and move attachments to file system. This will put all your attachments in a directory you chose and several sub-directories. In those directories, you will find files with the extension ".attach" . There is an Image Magick command line program called convert.

    Usage is:
    convert -resize <size option> <input file> <output file>. The size options can be WidthxHeight or percentages or several other options.
    "convert -h" will list your usage options.

    This operation can be done one at a time or batched into a script.

    After you are finished, resizing and renaming back to original names, import back into database and check to see if attachments are still working. If the attachments aren't working, you can always restore your backup.


    Comment


    • #3
      Thanks! I will try this!

      Comment


      • #4
        vBulletin 5 will resize images as they are used. If you update the sizes listed under Settings -> Options -> Message Attachment Options, it will invalidate existing images and resize them again when they are viewed.

        For storing images, it is really recommended to store them in the file system and not the database. The database storage could be considered legacy and is the default because we don't know the environment where vBulletin is being installed. We also don't know the level of expertise of the person installing the software. File Permissions can be tricky for some people.
        Translations provided by Google.

        Wayne Luke
        The Rabid Badger - a vBulletin Cloud demonstration site.
        vBulletin 5 API - Full / Mobile
        Vote for your favorite feature requests and the bugs you want to see fixed.

        Comment


        • #5
          The only thing with file system storage is that you will need to ensure you have a seperate backup of that folder.

          Comment


          • #6
            The link below has a bash script to tar a folder and email it to an address. Set it up on as a crontab job and you're all set.

            http://stackoverflow.com/questions/1...r-and-email-it
            Translations provided by Google.

            Wayne Luke
            The Rabid Badger - a vBulletin Cloud demonstration site.
            vBulletin 5 API - Full / Mobile
            Vote for your favorite feature requests and the bugs you want to see fixed.

            Comment


            • #7
              I'll do a good old batch file on our Windows server

              Comment

              Related Topics

              Collapse

              Working...
              X