Viewing 15 replies - 1 through 15 (of 45 total)
  • it worked for me in local. now online is not working

    I’m also having some trouble getting this to work with importing pics from Squarespace powered site. Some images come in but most don’t. It’s a large site with thousands of posts mostly all have images.

    I have already done some things on my end. I changed some settings in my php.ini file to allow for more memory usage, larger downloads and other changes that already helped to download all the posts even though the xml file was larger than most typical php.ini settings have by default.

    I’ve also continuously refreshed the import and attempted to download more with no success.

    If someone figures this out let me know.

    I did have a lot of tweaking to do to get it to work with squarespace – namely, looking for the differences in img extensions that they use. One of the big ones was adding this to the external_img_sideload function:

    if (($file_array[‘name’]) == “” && $ext2 == “?format=original”) {
    $file_array[‘name’] = “import.jpg”;
    }
    And adding this to external_img_get_img_tags :

    //check for squarespace images
    if ( $uri != ” && preg_match( ‘/^http:\/\//’ , $uri ) ) {
    //make sure it’s external
    if ( $s != substr( $uri , 0 , strlen( $s ) ) && ( !isset( $mapped ) || $mapped != substr( $uri , 0 , strlen( $mapped ) ) ) ) {
    $ext = substr( $uri , -16 );
    if ($ext == “?format=original”)
    $result[] = $uri;
    }
    }

    and finally changing is_external_file function like this:

    if ( in_array( strtolower($ext) , $allowed ) || $ext2 == “?format=original”)
    return true;

    I have a download for a modified version of this plugin that I tested on squarespace here: https://codingconcepts.net/importexternal.zip but I haven’t looked at it since I modified it… so no guarantees!

    Coding Concepts, I tried your modified plugin and it doesn’t seem to work either. Gives the same message “No images imported – you might want to check whether they still exist!”.

    Coding Concepts, I tried your modified plugin and it doesn’t seem to work either. Gives the same message “No images imported – you might want to check whether they still exist!”.

    I’d have to see what the file extensions are that you are using – they may be different than what I patched it for. Also looks like I missed a line that defines $ext2. Let me dig up the plugin and see what I can do.

    Here you go zamolkses, I just modified it to work with GoDaddy as well, but kept all of the squarespace code in there. Try this out.

    https://brendancarr.ca/import-external-images/

    Coding Concepts, I’ve tried several of the versions of the plugin you posted, but I’m still unable to import images hosted on squarespace. I’m getting the same error others are getting “No images imported – you might want to check whether they still exist!” despite the images definitely still existing.

    When I attempt to do this on an individual post, the page reloads and the same text is present “You have (1) images that can be imported!”

    Here’s an example of an image that isn’t being imported

    https://static1.squarespace.com/static/521e6810e4b0f17ecca9646b/521e6821e4b011d6bc2fd84b/56dca6e8e707eb815a7a910b/1457301256186//img.png

    I’m running WordPress 4.4.2 on Pantheon.io’s platform. Do you have any other suggestions?

    Interesting as it has the normal .png extension at the end – so it should work. Mine didn’t have normal extensions, hence why I had to rewrite it. Are they in a custom post type??

    These are normal posts in a standard Squarespace blog, we have a lightly customized theme, but in styles only. I’m not entirely clear on what else could be custom about them?

    When doing the mass-import, I was able to import 3 images that were hosted on AWS instead of directly in Squarespace. These were also interestingly all .jpgs, not .pngs.

    Do you have any other ideas?

    When I went to import from a few squarespace sites, they had this at the end of the src tag:

    ?format=original

    Which threw off the whole file extension testing in the function “is_external_file”. The plugin should (and does) import png files without issue – it was the rest of the src tag that was the problem. What else do you see in your src tags? Basically the entire <img src=””> not just the filename with extension.

    this is copied directly out of the imported post in WordPress

    <img src=”https://static1.squarespace.com/static/521e6810e4b0f17ecca9646b/521e6821e4b011d6bc2fd84b/56dca6e8e707eb815a7a910b/1457301256186//img.png&#8221; alt=”” />

    this is what that same image looks like on the current Squarespace site

    <img class=”thumb-image loaded” data-src=”https://static1.squarespace.com/static/521e6810e4b0f17ecca9646b/t/56dca6e8e707eb815a7a910b/1457301256186/&#8221; data-image=”https://static1.squarespace.com/static/521e6810e4b0f17ecca9646b/t/56dca6e8e707eb815a7a910b/1457301256186/&#8221; data-image-dimensions=”800×300″ data-image-focal-point=”0.5,0.5″ data-load=”false” data-image-id=”56dca6e8e707eb815a7a910b” data-type=”image” src=”https://static1.squarespace.com/static/521e6810e4b0f17ecca9646b/t/56dca6e8e707eb815a7a910b/1457301256186/?format=750w&#8221; data-image-resolution=”750w”>

    So Squarespace is actively formatting the image to be 750px wide instead of 800px wide using the ?format item. But the image loads normally using the src from the imported post in WordPress, with /img.png and without.

    Perhaps your Squarespace-specific code would work if it also cut off the final “/img.png” from the image src, leaving only “https://static1.squarespace.com/static/521e6810e4b0f17ecca9646b/521e6821e4b011d6bc2fd84b/56dca6e8e707eb815a7a910b/1457301256186/&#8221;?

    I’m gonna switch over from SquareSpace as soon as I can as well. I’m so tired of the restrictions over there.. I can’t even look at my own code.. ugh… so I may be back for help. LOL. Good Luck to you all.

    JB

    Also having trouble with Squarespace…

    So the imported content (within the actual posts) is proper:
    <img src="https://static1.squarespace.com/static/5006ebd724ac70f8fbc6a885/50072784e4b037d29c9239c8/56fa816d356fb022347b1429/1459257809110//img.jpg" alt="">

    However, if you visit this on Squarespace it changes to:
    <img style="-webkit-user-select: none" src="https://static1.squarespace.com/static/5006ebd724ac70f8fbc6a885/50072784e4b037d29c9239c8/56fa816d356fb022347b1429/1459257809110//img.jpg">

    Is the -webkit-user-select: none holding this up?

    I’ve noticed in the external_image_sideload function, download_url is returning a WP Error object for most (though not all) squarespace images. For example:
    $tmp = download_url( 'https://static1.squarespace.com/static/5485e4dfe4b0dfffd255aa3d/54873574e4b03dc720b4cb48/56f18b40d51cd45c19216891/1458670516015/asparagus.jpg' );
    returns http_404 error “Forbidden”

Viewing 15 replies - 1 through 15 (of 45 total)
  • The topic ‘Has anyone gotten this to work with Squarespace?’ is closed to new replies.