Skip to content
The Chat Archive
gpt-3.5-turbo-0613· OpenAI WildChat-4.8M (AI2)

scriptrunner confluence disable thumbnail

  1. User

    scriptrunner confluence disable thumbnail

  2. Assistant

    To disable thumbnails in Confluence using the Scriptrunner app, you can add a custom content formatting script. Follow these steps:

    1. Go to Confluence Administration.
    2. In the sidebar, click on "Add-ons" (or "Apps") and then select "Script Console" under the Scriptrunner section.
    3. Click on "Add a script" and choose "Custom Content Formatting."
    4. Now, enter the following script (groovy) code:
    import com.atlassian.confluence.pages.AttachmentManager
    import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport
    import org.springframework.beans.factory.annotation.Autowired
    
    // disable thumbnails
    @ComponentImport
    private AttachmentManager attachmentManager
    Attachments.RepresentationsMode disableThumbnails() {
        Attachments.RepresentationsMode originalMode = attachmentManager.getAttachmentsRepresentationsMode()
        attachmentManager.setAttachmentsRepresentationsMode(Attachments.RepresentationsMode.NONE)
        return originalMode
    }
    
    // enable thumbnails
    @ComponentImport
    private AttachmentManager attachmentManager
    void enableThumbnails(Attachments.RepresentationsMode originalMode) {
        attachmentManager.setAttachmentsRepresentationsMode(originalMode)
    }
    
    disableThumbnails()
    // enableThumbnails(<originalMode>) if you want to enable thumbnails again
    
    1. Click on "Run" to execute the script.

    This script will disable thumbnails in Confluence. If you want to enable thumbnails again later, you can uncomment the last line and replace <originalMode> with the original mode returned by the disableThumbnails() function.