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

Feature request: Add more methods to the interface #12

Open
tdgroot opened this issue Jun 19, 2018 · 1 comment · May be fixed by #13
Open

Feature request: Add more methods to the interface #12

tdgroot opened this issue Jun 19, 2018 · 1 comment · May be fixed by #13
Assignees

Comments

@tdgroot
Copy link

tdgroot commented Jun 19, 2018

Cool module! I implemented it into a project I'm working on, it works great. A few suggestions, though:

  • Add a method to just resize.
  • Add a method to get absolute path / make the current absolute path method public.
  • Add a method to get relative path / make the current relative path method public.

Please let me know what your thoughts are, I'm willing to contribute!

I had to create my own class to get it working:

<?php

namespace Marissen\QuotationSheet\Helper;

use Magento\Catalog\Model\Product;
use Staempfli\ImageResizer\Model\Resizer;

class ImageResizer extends Resizer
{
    public function getPath(Product $product): string
    {
        $imageObject = $product->getMediaGalleryImages()->getFirstItem();

        if (!$imageObject->getData('url')) {
            return '';
        }

        $this->resizeAndGetUrl($imageObject->getData('url'), 200, 200);

        return $this->getAbsolutePathResized() ?: '';
    }
}
@jalogut
Copy link
Contributor

jalogut commented Jul 2, 2018

Hi @tdgroot

Thanks for your suggestions If you think that these methods can be handy for other people, we'd be glad to merge your PR.

@jalogut jalogut changed the title Add more methods to the interface Feature request: Add more methods to the interface Jul 2, 2018
@jalogut jalogut self-assigned this Jul 2, 2018
@tdgroot tdgroot linked a pull request Jul 5, 2018 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants