Change images width and height

Hi there, I need your help as i did a project for my client, but after a while he asked to replace some images with others, but i couldn't come back to the hype source, so is there any way to change the width and height for images from the exported files!
I am already replaced the images with same name, but it still takes the width and height as old images

First, see if you got lucky…

https://tumult.com/hype/documentation/#document-recovery

If your Hype Resource folder has the recoverable file, then you could simply restore your Hype project from the exported HTML.

That's Hype doing its thing. There are different possible solutions to this problem…

  1. Crop / Resize the new images to fit the existing space in Hype.
  2. Add CSS to the HTML page to resize those elements to the new size. If your Hype project was allowed to accept external CSS, then perhaps a new style using the !important property could override the size of those image boxes.
  3. Perhaps manually added JavaScript could be used to resize the image elements. (That's quite a kludgy fix — not recommended.)
  4. Edit the JavaScript source of the exported file.

That last one is tricky. The JavaScript is minimized, making it hard to read and edit. I did a test with one of my Hype projects…

There's a file that ends with… _hype_generated_script.js …in the “.hyperesource” folder and it stores the information related to the elements in the document.

Since I know the ID of the element I want to change, I searched the document (using Visual Studio Code) to find that ID name… which in this example is “Back-1”.

I was confused by the size values, as it's set to 140 pixels wide in the Hype document, but it appears to be 132 in the hype generated script file. So, the border size is a factor.

But anyway, here's the translation…

  • a = Left (X location value)
  • b = Top (Y location value)
  • c = Width
  • d = Height

So, theoretically, if you update those values to match the new image size… ehhhh… maybe it will work. You might want to backup that file before editing it though, otherwise your situation could get worse.

5 Likes

thank you for your great help