Git Product home page Git Product logo

Comments (10)

darylknight avatar darylknight commented on August 21, 2024 1

Ok no worries Ben - I'll do some digging and let you know if I find anything. Otherwise I'll assume it's down to their Windows hosting. Thank you for your time :)

from craft-embedded-assets.

benjamminf avatar benjamminf commented on August 21, 2024

Hey Daryl, thanks for the report!

The fileinfo extension needs to be enabled. If there's a warning sign next to it, it might be an old or broken version of the extension.

Funnily enough, I only introduced the need for the fileinfo extension to fix a bug (#17) about mime_content_type() not working in some later versions of PHP (5.3+). It wouldn't be hard to add back in mime_content_type() as a fallback.

from craft-embedded-assets.

darylknight avatar darylknight commented on August 21, 2024

Thanks Ben - it's not a site I host so I've put in a request to their company to enable it. Any idea off the top of your head if there's a specific version of it that needs to be enabled?

from craft-embedded-assets.

benjamminf avatar benjamminf commented on August 21, 2024

Unfortunately, I can't say what it could be. I figured with it fresh in my mind, and being an easy fix, I've gone ahead and written a fallback if the fileinfo extension isn't usable. It should be available on the master branch. Let me know if it does or doesn't work 👍

from craft-embedded-assets.

darylknight avatar darylknight commented on August 21, 2024

Thanks Ben. That seems to let me upload assets again, but I can't get them to display in my template. Your example code has worked fine on other sites, so I'm wondering if there's an issue with the uploaded files or detection.

{% for video in block.asset %}
    <p>{{ video.title }}</p>
    {% set embed = craft.embeddedAssets.fromAsset(video) %}
    <p>Length: {{ embed|length }}</p>
    {% if embed %}
        {{ embed.safeHtml|raw }}
    {% endif %}
{% endfor %}

The code above outputs the video's title, so Craft knows the asset is there and exists, but it also outputs Length: 0, so it looks like EA isn't recognising it as an asset. Am I correct in thinking that's what's going on? Where am I going wrong?

from craft-embedded-assets.

benjamminf avatar benjamminf commented on August 21, 2024

Hm, that's interesting. It seems like the file isn't being read. I'm using two methods of reading the contents of the JSON file, through cURL, and file_get_contents as a fallback. Pretty low chance of both of those not being available, but it might be the case. Do you know if the curl extension is enabled?

from craft-embedded-assets.

darylknight avatar darylknight commented on August 21, 2024

cURL support has a green tick next to it in /utils

from craft-embedded-assets.

benjamminf avatar benjamminf commented on August 21, 2024

Also, just to be safe, can you check the contents of the JSON file that gets generated? Want to make sure it's being uploaded okay.

from craft-embedded-assets.

darylknight avatar darylknight commented on August 21, 2024

Contents of test json file:

{"type":"video","url":"http:\/\/www.youtube.com\/watch?v=LBc7X8gMPwg","requestUrl":"https:\/\/www.youtube.com\/watch?v=LBc7X8gMPwg","title":"Dreamstate Logic - Galaxy's Child","description":"In order to more fully understand this reality, we must take into account other dimensions of a broader reality, the introduction of higher dimensions of con...","authorName":"SpaceAmbient","authorUrl":"https:\/\/www.youtube.com\/user\/SpaceAmbient","providerName":"YouTube","providerUrl":"https:\/\/www.youtube.com\/","cacheAge":"","thumbnailUrl":"https:\/\/i.ytimg.com\/vi\/LBc7X8gMPwg\/hqdefault.jpg","thumbnailWidth":"480","thumbnailHeight":"360","html":"<iframe width=\"1280\" height=\"720\" src=\"https:\/\/www.youtube.com\/embed\/LBc7X8gMPwg?feature=oembed\" frameborder=\"0\" allowfullscreen><\/iframe>","safeHtml":"<iframe width=\"1280\" height=\"720\" src=\"https:\/\/www.youtube.com\/embed\/LBc7X8gMPwg?feature=oembed\" frameborder=\"0\"><\/iframe>","width":"1280","height":"720","__embeddedasset__":true}

from craft-embedded-assets.

benjamminf avatar benjamminf commented on August 21, 2024

Everything seems like it should be fine. Clearly the problem is in reading the file, but I'm not sure why that would be failing. If you locate the _readExternalFile method in EmbeddedAssetsService, this is where the file is being read. Try adding in some var_dump(); exit;'s on some of the variables, to see where it's breaking. curl_error() might be throwing an error that I'm just ignoring.

Sorry I can't be much more of a help!

from craft-embedded-assets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.