Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exported assets/images with 0 bytes #280

Closed
decrecementofeliz opened this issue Mar 16, 2023 · 12 comments · Fixed by #291
Closed

Exported assets/images with 0 bytes #280

decrecementofeliz opened this issue Mar 16, 2023 · 12 comments · Fixed by #291

Comments

@decrecementofeliz
Copy link

Hi!

When I export the theme with the plugin, the image files used in the templates are exported (as mentioned in #213) but they contain no info, 0 bytes.

To reproduce (WP 6.1.1, Create Block Theme 1.7.0)

  • On this plugin, create a blank theme and activate
  • On the footer template, add and Image block and upload to the library a png file

imagen

  • On this plugin, Export the theme
    imagen

  • The generated .zip file contains the image file in /assets/images, but its size is 0 bytes. So it fails to load when I try to upload this theme into another installation

imagen

p.d. I'm quite new to FSE and so on, git included, so maybe I'm missing something, sorry in advance and thank you for this plugin, I'm learning a lot!

@matiasbenedetto
Copy link
Contributor

Hi @decrecementofeliz 👋
Thanks for reporting this issue! I just tried adding an image to a footer template part and it worked as expected. So I'm thinking about what can be happening in your case.

Is the file hosted in the local WordPress media files or is it a linked file?
Have you tried with other image files to see if that the same problem occurs?
Which PHP version and server you are running?

It would be helpful also if you can record a screencast video adding the image in the editor and after that export the theme. Maybe it would be useful to spot details I cannot see in the screenshots.

@matiasbenedetto matiasbenedetto added the bug Something isn't working label Mar 16, 2023
@decrecementofeliz
Copy link
Author

decrecementofeliz commented Mar 16, 2023

That's fast :) Thank you
I have recorded the issue, trying with png, webp and jpg files

The server is quite standard for me, isn't it?:
Linux 5.10.0-0.deb9.20-amd64 x86_64
Apache
7.4.33 (Soporta os valores de 64 bits)

@matiasbenedetto
Copy link
Contributor

matiasbenedetto commented Mar 17, 2023

Hi @decrecementofeliz 👋 thanks for the screencast.
It's possible that your PHP config is making the plugin fail to download the images.
You need to have allow_url_fopen = On in your PHP config.
Could you check if you have that setting enabled in your php.ini file, please?
Let me know if you need help with that.

@matiasbenedetto matiasbenedetto removed the bug Something isn't working label Mar 17, 2023
@decrecementofeliz
Copy link
Author

Hi again, allow_url_fopen is ON
imagen

I'm wondering now, if I should I have the Gutenberg plugin installed and activated, but I have tested right now and the problem persists, no clue :(

@matiasbenedetto
Copy link
Contributor

@decrecementofeliz I have another question:

Have you tried adding google fonts to your theme using the plugin? Did that work as expected?
If you haven't tried that yet: could you try it and let me know if it works, please?

I'm trying to figure out what can be causing the 0-byte image files.

@decrecementofeliz
Copy link
Author

Hi Matias, thanks for keeping up.

Fonts are working ok, I had already uploaded my custom local font and now I have added Google fonts, too, both type of files get correctly downloaded. But images still don't

image

@matiasbenedetto
Copy link
Contributor

matiasbenedetto commented Mar 22, 2023

both type of files get correctly downloaded

Good to know!

@decrecementofeliz: Does the image problem happen only when you are creating a .zip file (with the export or clone options of the plugin) or when you overwrite the local theme (with the overwrite option of the plugin) too?

@decrecementofeliz
Copy link
Author

decrecementofeliz commented Mar 22, 2023

It happens either way.

On a different WP installation, on a different server from previous site I ran this:

  • Activated TT3 theme, edited the Footer part and inserted there an image block.
  • Then on the plugin I tried all possible options, in this order: Export (twentytwentythree.zip), Create child of TT3 (tt3child.zip), Clone TT3 (tt3clone.zip), Overwrite (and then Export again, twentytwentythree-2.zip).

All these files contained 0-bytes images on assets/images.

@matiasbenedetto
Copy link
Contributor

Hi @decrecementofeliz, I submitted a potential fix for this issue: #291
It would be helpful if you could try the fix. To do that, you can uninstall your current version of the plugin and download the plugin version linked in #291 .

@decrecementofeliz
Copy link
Author

decrecementofeliz commented Mar 29, 2023

Hi Matias, I've tested the fix and now it works!
image

To make sure about everything I tried it all over in a new fresh installation:

  • First with the bug-version of the plugin I created TT3 child theme, added an image on the footer, exported the theme > 0 bytes on asset file.
  • Then I deleted the plugin, uploaded the fix-version of the plugin and exported the theme again > image file is saved correctly

p.d. I had to upload and uncompress the .zip file through FTP because through the WP admin it warned me about potential malware on the file.

Let me know if you want to me to test anything else about #291 and thanks!

@matiasbenedetto
Copy link
Contributor

Thanks for reporting and testing @decrecementofeliz !

@matiasbenedetto
Copy link
Contributor

The fix for this issue was released on the latest version (1.8.0). If you find new problems around this feel free to re-open.
Thanks again for reporting and debugging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants