JoyPixels Labs

version 8.0

Alternate Alt Tags

By default, both the Javascript and PHP toolkits we've provided will use the native unicode character as the alt tag for converted <IMG> tags (PNG). Doing this makes it so that if you copy and paste the converted text, in most cases, it will copy the native unicode emoji instead of the image.

You can optionally turn this off by setting unicodeAlt to false. If set to false, the toolkits will use the :shortname: as the alternate text instead. Copy and paste the text below to see what we mean.

Unicode Alt Example:

PNG: Hello world! 😄 

Copy & Paste Here:

Code:

<script type="text/javascript">
    $(document).ready(function() {
        joypixels.imageType = 'png';
        var input = $('#example1-png').html();
        var replaced = joypixels.toImage(input);
        $('#example1-png').html(replaced);
    });
</script>

Shortname Alt Example:

PNG: Hello world! 😄 

Copy & Paste Here:

Code:

<script type="text/javascript">
    $(document).ready(function() {
        // turn unicode alternate text off!
        joypixels.unicodeAlt = false;

        joypixels.imageType = 'png';
        var input = $('#example2-png').html();
        var replaced = joypixels.toImage(input);
        $('#example2-png').html(replaced);
    });
</script>