# Setting the width of an image in a HTML5 template

**URL:** <https://casparcgforum.org/t/setting-the-width-of-an-image-in-a-html5-template/4185>\
**Category:** General\
**Created:** [May 5, 2021, 12:38pm UTC](https://casparcgforum.org/t/setting-the-width-of-an-image-in-a-html5-template/4185 "2021-05-05T12:38:13Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![Tuomo](https://casparcgforum.org/user_avatar/casparcgforum.org/tuomo/32/995_2.png) [@Tuomo](https://casparcgforum.org/u/Tuomo)\
**Post date:** [May 7, 2021, 12:32pm UTC](https://casparcgforum.org/t/setting-the-width-of-an-image-in-a-html5-template/4185/21 "2021-05-07T12:32:17Z")

</div>

Sorry, but cannot help further with details. Have you tried to add some `console.log('here we go')` messages somewhere to see how far is your javascript logic running, if for some reason it stops. You should see these messages in your CasparCG console.

---

<div class="post-metadata">

**Author:** ![Ingo](https://casparcgforum.org/user_avatar/casparcgforum.org/ingo/32/1419_2.png) [@Ingo](https://casparcgforum.org/u/Ingo)\
**Post date:** [May 7, 2021, 12:36pm UTC](https://casparcgforum.org/t/setting-the-width-of-an-image-in-a-html5-template/4185/22 "2021-05-07T12:36:02Z")

</div>

No I haven’t done that yet.

I’ll investigate on that.

Thanks.

Ingo

---

<div class="post-metadata">

**Author:** ![didikunz](https://casparcgforum.org/user_avatar/casparcgforum.org/didikunz/32/7_2.png) [@didikunz](https://casparcgforum.org/u/didikunz)\
**Post date:** [May 7, 2021, 12:59pm UTC](https://casparcgforum.org/t/setting-the-width-of-an-image-in-a-html5-template/4185/23 "2021-05-07T12:59:35Z")

</div>

…and always try inside a Caspar, not in a browser.

---

<div class="post-metadata">

**Author:** ![andyw](https://casparcgforum.org/letter_avatar_proxy/v4/letter/a/f05b48/32.png) [@andyw](https://casparcgforum.org/u/andyw)\
**Post date:** [May 7, 2021, 2:21pm UTC](https://casparcgforum.org/t/setting-the-width-of-an-image-in-a-html5-template/4185/24 "2021-05-07T14:21:44Z")

</div>

As well as the console.log diagnostic tool you can also use an instance of Chrome running on the Caspar server that links into the running CasparCG templates.

The following link shows a post from hreinnbeck with very clear guidance on how to connect the Chrome to CasparCG. Once you open the template you have access to the console, console log, all error reports, timing data etc, and an ability to inspect objects and variables.

> [@HTML Remote Debugging: document.registerElement](https://casparcgforum.org/t/html-remote-debugging-document-registerelement/2765/2):
>
> Not sure about that but I’d recommend: Go to chrome://inspect/#devices Check Discover network targets Click Configure and add 127.0.0.1:8081 In a few seconds you should get the running templates listed on the page. Then you can use the latest Chrome DevTools instead of the one in Chromium. Update: document.registerElement was part of web components v0 and deprecated (so it’s used in the old Devtools in Chromium but no longer supported in Chrome). You could use an older version of Chrome i…

---

<div class="post-metadata">

**Author:** ![Ingo](https://casparcgforum.org/user_avatar/casparcgforum.org/ingo/32/1419_2.png) [@Ingo](https://casparcgforum.org/u/Ingo)\
**Post date:** [May 8, 2021, 12:21pm UTC](https://casparcgforum.org/t/setting-the-width-of-an-image-in-a-html5-template/4185/25 "2021-05-08T12:21:48Z")

</div>

Hello again,

I’d like to say thank you to all who helped me with this topic.

It works fine now.  
The actual problem was that the PLAY function in my caspar.js was never triggered although I sent a play command. I suppose that the play command from my client was sent before the template was completely loaded.  
Now I leave a little pause of about half a second between ADD and PLAY command and everything works fine. Funny thing was that CCG console logged PLAY OK in any case.

Thank you all for your support. 😀

Cheers  
Ingo

---

<div class="post-metadata">

**Author:** ![hreinnbeck](https://casparcgforum.org/user_avatar/casparcgforum.org/hreinnbeck/32/154_2.png) [@hreinnbeck](https://casparcgforum.org/u/hreinnbeck)\
**Post date:** [May 8, 2021, 1:19pm UTC](https://casparcgforum.org/t/setting-the-width-of-an-image-in-a-html5-template/4185/26 "2021-05-08T13:19:41Z")

</div>

> [@Ingo](#):
>
> Funny thing was that CCG console logged PLAY OK in any case.

That just means that the PLAY commands was successfully sent (or queued to be sent) to the template but does not indicate that it actually fired in the template itself since there is no communication back from it.

You should look your template over and see why you need such a big delay as 500ms. The PLAY command is queued until the template should be fully loaded.

---

<div class="post-metadata">

**Author:** ![Ingo](https://casparcgforum.org/user_avatar/casparcgforum.org/ingo/32/1419_2.png) [@Ingo](https://casparcgforum.org/u/Ingo)\
**Post date:** [May 9, 2021, 9:43am UTC](https://casparcgforum.org/t/setting-the-width-of-an-image-in-a-html5-template/4185/27 "2021-05-09T09:43:57Z")

</div>

Hi hreinnbeck

I tried to reproduce the error today but can’t.  
It now works with or without the delay although nothing has changed. 🤔  
Pretty strange. Maybe the reboot of the complete system this morning made the difference.

Anyway let’s hope it runs stable now.

Ingo

[Previous page](https://casparcgforum.org/t/setting-the-width-of-an-image-in-a-html5-template/4185.md?page=1)
