Giter Site home page Giter Site logo

Comments (5)

marianop avatar marianop commented on April 20, 2024 1

Hi! I'm going to expand on this.

In the Image Element this properties are set:

const ASPECT_FIT = 'aspect-fit';
const ASPECT_FIT_ONLY = 'aspect-fit-only';
const FULLSCREEN = 'fullscreen';
const NON_INTERACTIVE = 'non-interactive';

The same way they are on the Video Element.
Even there is the withPresentation function, that has been duplicated from the Video Elemento because the comment has the Video on it:

/
**
     * Sets the aspect ration presentation for the video.
     *
     * @param string $presentation one of the constants ASPECT_FIT, ASPECT_FIT_ONLY, FULLSCREEN or NON_INTERACTIVE
     * @see Image::ASPECT_FIT
     * @see Image::ASPECT_FIT_ONLY
     * @see Image::FULLSCREEN
     * @see Image::NON_INTERACTIVE
     *
     * @return $this
     */
    public function withPresentation($presentation)
    {
        Type::enforceWithin(
            $presentation,
            [
                Image::ASPECT_FIT,
                Image::ASPECT_FIT_ONLY,
                Image::FULLSCREEN,
                Image::NON_INTERACTIVE
            ]
        );
        $this->presentation = $presentation;

        return $this;
    }

But in the ImageRule Transformer, the rules for the properties are missing, specifically this:

if ($this->getProperty(Image::ASPECT_FIT, $node)) {
            $image->withPresentation(Image::ASPECT_FIT);
        } elseif ($this->getProperty(Image::ASPECT_FIT_ONLY, $node)) {
            $image->withPresentation(Image::ASPECT_FIT_ONLY);
        } elseif ($this->getProperty(Image::FULLSCREEN, $node)) {
            $image->withPresentation(Image::FULLSCREEN);
        } elseif ($this->getProperty(Image::NON_INTERACTIVE, $node)) {
            $image->withPresentation(Image::NON_INTERACTIVE);
        }

I added them and worked perfectly.

from facebook-instant-articles-sdk-php.

marianop avatar marianop commented on April 20, 2024 1

I tried, but I'm not an approved contributor so I can't make PRs :(

from facebook-instant-articles-sdk-php.

everton-rosario avatar everton-rosario commented on April 20, 2024

@marianop Can you send a PR with that fix?

from facebook-instant-articles-sdk-php.

everton-rosario avatar everton-rosario commented on April 20, 2024

@marianop What do you mean?
If you follow the steps here, you will be promoted as a contributor:
https://github.com/facebook/facebook-instant-articles-sdk-php/blob/master/CONTRIBUTING.md

Let me know if you have any problem on these steps.

from facebook-instant-articles-sdk-php.

everton-rosario avatar everton-rosario commented on April 20, 2024

Fixed in PR #147

from facebook-instant-articles-sdk-php.

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.