• Resolved jeanphilippegrasse

    (@jeanphilippegrasse)


    Hello,
    I’ve just noticed that exporting heavy photos doesn’t really work anymore…
    Everything works on WordPress, but once exported, the photos are broken in the upload folder.

    These are HD photos, quite large in size. But it worked when I set up the gallery several months ago.
    I use Beaver Builder to design the site.

    Do you have a solution?
    Thanks a lot 🙂

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author patrickposner

    (@patrickposner)

    Hey @jeanphilippegrasse,

    thanks for the report!

    We introduced a 2 MB limit on fetching pages/files in 3.1.4 to avoid PHP timeouts (recommended by WP Core when using wp_remote_get()).

    That works fine in most cases, but in your particular use case, it does skip these images 😅

    Are you familiar with adding code snippets to your website?

    I added a filter around the new implementation, so you can easily remove this limit with the following code:

    add_filter( 'ss_remote_get_args', function ( $args ) {
    	unset( $args['limit_response_size'] );
    
    	return $args;
    } );

    Cheers,
    Patrick

    Thread Starter jeanphilippegrasse

    (@jeanphilippegrasse)

    Hi!
    thanks for your reply!
    So I added this code with the plugin “PHP Code Snippets”, but it doesn’t work, I still have broken images in the uploads folder…

    Or maybe I’m doing it wrong…

    Plugin Author patrickposner

    (@patrickposner)

    Hey @jeanphilippegrasse,

    I just checked the page you added on your initial ticket – most of these images should get copied even without the snippet.

    I’ve set up a sample website and added high-res images from unsplash.com + some sample videos, which also worked fine on export.

    So the problem might be something else.

    What if you add the directory in Simply Static -> Settings -> General -> Additional Files and directories – are they copied on running the export?

    Thread Starter jeanphilippegrasse

    (@jeanphilippegrasse)

    I haven’t yet deployed the site after adding the code.
    They are copied, but appear broken in my folder after export (simply-static-1-XXXX/wp-content/uploads/2023/12/…).

    Well, I’ve added the directory to the export as you suggest.
    It took a lot longer and exported a lot more files, but still with broken photos finally in the folder…

    Plugin Author patrickposner

    (@patrickposner)

    Hey @jeanphilippegrasse,

    can you share the debug log with us?

    You can enable it in Simply Static -> Settings -> Misc -> Debugging Mode.

    Then, run a new export, and you can download the file from Simply Static -> Generate.

    This should give us more information on what is happening here and why these files might not be moved/exported successfully.

    Thread Starter jeanphilippegrasse

    (@jeanphilippegrasse)

    Hey,
    I was just about to reply.
    I changed the plugin to inject the php code you gave me. And it works now! I use “Code Snippets” now.
    I think the problem was the WordPress limitation you mentioned at the beginning, and the first plugin I used to inject the code…

    Plugin Author patrickposner

    (@patrickposner)

    @jeanphilippegrasse Amazing!

    I’ll go ahead and close this ticket now, but feel free to open a new one if you run into any other problems!

    Cheers,
    Patrick

    • This reply was modified 5 months, 2 weeks ago by patrickposner.
    sc250024

    (@sc250024)

    I’m curious about the UX around this, and why people are obliged to make a theme change for something like this?

    The 2 MiB limit seems paltry these days; I don’t know many websites that that are uploading photos (and let’s not get into video) that are less than that. Even a low-tier smartphone with a subpar camera will take a picture, and store it as a JPEG above 2 MiB.

    Should this not be a setting on the main plugin itself?

    Plugin Author patrickposner

    (@patrickposner)

    Hey @sc250024,

    thanks for your input!

    I at least partly agree with you:

    I think there should be a setting, and I will add one in the next update.

    I don’t think it should be more than 2 MiB by default.

    Here’s why:

    wp_remote_get()

    wp_remote_get() doesn’t give you a specific error if you hit a timeout, so we never know if the export failed because of a big file or some issue with the connection in general.

    We have a lot of users on really cheap shared hosting providers, and they cause quite some work for us in support – skipping larger files results in more successful exports by default.

    limitations of static hosting providers

    This does come from the perspective of our pro version, but it also applies to the free version: almost all static hosting providers have a maximum file size limit and will deny requests (or even block you for some time) if you exceed it.

    A couple of examples:

    • Cloudflare Pages has a 2 MB limit
    • GitHub Pages has a 2 MB limit
    • Netlify has a 5 MB limit
    • Algolia (the search integration) has a 2 MB limit

    Other media files:

    Offloading video files shouldn’t be done via Simply Static, or at least not by default.

    I agree that there should be an option for professionals and devs (that’s why we added the filter), but not for the average user, as it drastically increases the risk of timeouts on the server.

    We already batch process all of our processes, but now imagine someone has a 200MB video file uploaded to WordPress on an average hosting plan – adding that to the ZIP file will, in 99% of the cases, exceed the 30-second time limit most servers force and there would be no way to avoid that without requiring a running WP-Cron or the ability of background processes.

    I don’t want to sound rude, but I figured sharing my thoughts on why we added it in the first place would help a lot in understanding it 🙂

    Cheers,
    Patrick

    sc250024

    (@sc250024)

    Patrick,

    I see, that makes sense. I didn’t realize that 2 MiB was that common on static hosting providers. In our case, we run the pro version of the plugin, and the website is hosted out of Amazon S3.

    Thank you also for the plugin update too. Based on your comments, does that mean it’s better (for large files at least) to skip uploading them to WordPress directly, and instead upload them directly to S3 (in our case) or some other place where the files can just be accessed directly?

    Plugin Author patrickposner

    (@patrickposner)

    Hey @sc250024,

    that was quick feedback! 😁

    Yeah, in the case of AWS S3, there are, thankfully, no such limitations.

    I also find it quite silly to have a 2MiB limit on various providers, but that’s often just the tip of the iceberg – in terms of the GitHub integration, we now have an entire class handling all sorts of different API limits (filesize, number of commits, number of files within a tree, auto-handling for blocked requests..).

    Media files on S3

    AWS S3 is a lot more forgiving here.

    Our integration can easily transfer files up to 500 MB in size to S3 – so as long as you don’t have 5GB+ HD videos stored in WordPress, it should be fine to keep uploading them with Simply Static!

    Cheers,
    Patrick

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.