On the support page for asset management, there’s a video that shows the user how to rename a file:
However, I don’t seem to be able to edit files anymore? The filename on the popup is not editable. Is this intentional?
On the support page for asset management, there’s a video that shows the user how to rename a file:
However, I don’t seem to be able to edit files anymore? The filename on the popup is not editable. Is this intentional?
Hey @noelleleigh,
Unfortunately, Glitch does not support renaming files in the assets folder any more. To use the image in your project, you’ll have to copy the link of the image that shows up on the popup and paste it in your code.
If you still insist on having images in the name you want, you could do the following steps:
Go to the assets folder in your project and select the image you want to upload locally to your Glitch project. Click on the ‘copy url’ button. This will copy an image url like https://cdn.glitch.com/f6254aa9-8051-48db-bbc1-5e7766f748c5%2Fw6.jpg?1531238960521
to your clipboard.
Go to the console in Glitch, and create an assets folder by typing mkdir assets
and hit enter.
type cd assets
and hit enter to move into the assets folder
type wget
and then paste the image url you copied previously into the console, so you see something like wget https://cdn.glitch.com/f6254aa9-8051-48db-bbc1-5e7766f748c5%2Fw6.jpg?1531238960521
and hit enter. That’ll import that image to your assets folder. Note that it’ll be imported with the name f6254aa9-8051-48db-bbc1-5e7766f748c5%2Fw6.jpg?1531238960521
. To make it easier to deal with you’ll want to rename it. To do so, type mv /app/assets/f6254aa9-8051-48db-bbc1-5e7766f748c5%2Fw6.jpg?1531238960521 /app/assets/w6.jpg
and hit enter. You can confirm the asset renamed correctly by typing ls -al
and you’ll see a list of files, one of which should be called w6.jpg
.
Repeat steps 1 and 4 for each image you want to upload. Be sure to change the name of the file to the relevant one in step 4.
The path you’ll then use is to refer to your files: __dirname + '/assets/w6.jpg'
NOTE: w6.jpg
is just an example file. Replace w6.jpg
with the name you want to give to the file.
Thanks for the confirmation @khalby786! Will that support article be updated to clarify that renaming assets is not supported?
Also, is the assets
folder name special? Or can it be anything?
The article will be updated (or we can just ping @Glitch_Response). The assets folder is just a virtual folder and it is not locally present in the project!
As @khalby786, the assets
drawer isn’t a folder in the same sense as all the other folders in your project, so it can’t be renamed or moved. With respect to this specific question:
assets
behavior is likely to change at some point in the future - we have work planned to clarify and simplify how some of this works that will probably fundamentally change how these things fit together, but I’m not sure when we’ll get to that work.Sorry for the bother!