• Original article written by kawaii.

    Movim is a decentralized social network, written in #PHP and HTML5 and based on the XMPP standard protocol. One of my faviourite features in Movim is that you can send #stickers to your friends. By default #Movim comes bundled with a few sticker packs but if like me you'd like to extend this and add your own then it's surprisingly not too difficult! There are three main components to creating your own sticker pack:

    You'll need to find the following directory on your Movim server filesystem:

    /var/www/movim/app/widgets/Stickers/stickers/
    

    Within this directory you will see the default Movim sticker packs i.e. 'mochi' and 'racoon'. Create a new directory here, for this example call it 'mystickers' or something. Within this directory create a new file called 'info.ini'. The contents of this file describe some basic information about the sticker pack. Here is an example from the 'racoon' set:

    author      = Corine Tea 
    license     = CreativeCommon BY SA
    url         = https://lechocobo.wordpress.com/
    

    Edit and enter the relevant details into the file and then save it. Now we need to add our 'icon.png' to this directory. This is a small image that will be displayed in the list of sticker packs within the Movim client itself. You must name this file exactly 'icon.png' or it will not be displayed. Finally, your actual sticker images themselves. Movim will not simply load any image within the directory. Your images must be converted so that the filename is the SHA1 hash of the file contents, plus the file extension (PNG). You can use the following #Python script created by James Curtis to rename any image files (except icon.png) into an acceptable format for use within Movim:

    import hashlib
    import os
    from glob import glob
    
    image_file_list = glob('*.png')
    
    for image in image_file_list:
        if not image == "icon.png":
            image_hash = hashlib.sha1(open(image, 'rb').read()).hexdigest()
            os.rename(image, "{image_hash}.png".format(image_hash=image_hash))
    

    Any image with the '.png' extension within your new sticker pack directory will have been converted so that the filename is the correct SHA1 hash which Movim will accept and display. Enjoy your new stickers! :)

    Special thanks to Jaussoin Timothée for creating Movim and to James Curtis for providing the Python script used to convert the image filenames to the required SHA1 hash.

  • Read more 2 1