showcode icon indicating copy to clipboard operation
showcode copied to clipboard

(API) lockWindowSize set to true can cut some content off

Open ModestasV opened this issue 3 months ago • 0 comments

When trying to implement the API usage, I've seen lockWindowSize trying to cut off some content. Here's an example request:

{
            "settings": {
                "themeName": "github-dark",
                "title": "Hello from API!",
                "showHeader": 0,
                "showTitle": 0,
                "showMenu": 0,
                "borderRadius": 0,
                "lockWindowSize": 1
            },
            "editors": [
                {
                    "language": "php",
                    "value":"test123"
                }
            ]
        }

This produces the following image:

image

As you can see, the 3 is gone and nowhere to be found. This can be experienced with longer strings, too:

{
            "settings": {
                "themeName": "github-dark",
                "title": "Hello from API!",
                "showHeader": 0,
                "showTitle": 0,
                "showMenu": 0,
                "borderRadius": 0,
                "lockWindowSize": 1
            },
            "editors": [
                {
                    "language": "php",
                    "value": """
                     showcode_request = requests.post("https://api.showcode.app/generate", json=payload, headers=headers, stream=True)
        if showcode_request.status_code == 200:
            with open('_temp/code.png', 'wb') as temp_file:
                showcode_request.raw.decode_content = True
                shutil.copyfileobj(showcode_request.raw, temp_file)
        carbon_image = Image.open('_temp/code.png')
        # Place the code on the image
                    """
                }
            ]
        }

This produces an image that looks like this:

image

Which is again cut off at some point.

I have tried playing with the settings, but no luck figuring it out (without manually passing width/height).

Not sure if I'm doing something wrong or this is a bug :)

ModestasV avatar Mar 07 '24 09:03 ModestasV