Git Product home page Git Product logo

magento2-module-image-resizer's People

Contributors

audef1 avatar clivewalkden avatar davidlambauer avatar jalogut avatar mbernabeu avatar midnightdesign avatar schmengler avatar staempfli-webteam avatar zekkai707 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

magento2-module-image-resizer's Issues

Watermark in images

Hi,

Is there any possibility to add watermarks to resized images, the way Magento 2 does this too?

Images dont resize if the url path is given for an image assigned to the catalog/product/

Staempfli\ImageResizer\Model\Resizer: initRelativeFilenameFromUrl()
this gets the image path based relative to the /cache/ folder.

protected function initRelativeFilenameFromUrl(string $imageUrl)
    {
        $this->relativeFilename = false; // reset filename in case there was another value defined
        $mediaUrl = $this->storeManager->getStore()->getBaseUrl(UrlInterface::URL_TYPE_MEDIA);
        $mediaPath = parse_url($mediaUrl, PHP_URL_PATH);
        $imagePath = parse_url($imageUrl, PHP_URL_PATH);

        if (false !== strpos($imagePath, $mediaPath)) {
			
            $this->relativeFilename = str_replace($mediaPath, '', $imagePath);
			if(strstr($this->relativeFilename,"/cache/"))
			{
				list($first,$second) = explode("/cache/",$this->relativeFilename);
				
				$path = explode("/",$second);
				array_shift($path);
				$this->relativeFilename = $first . "/" . implode("/",$path);
			}
				
        }
		
    }

does not support theme images

This module assumes, that the images reside in /pub/media. But what about images from /pub/static? E.g. any images from themes. Is this module not supposed to support those files as well?

Feature request: Set Image Compression

As far as I can see, there is no way to set the compression of the images, right?

I am optimizing page speed right now, and the images in general are a big problem because of too little or no compression

Directory separator incorrectly used for URL in getResizedImageUrl()

Hi,

On Windows machines the use of the directory separator in getRelativePathResizedImage() which is called within getResizedImageUrl causes issues as URL's are generated in the following format.

http://domain.com/media/staempfli_imageresizer\cache\wysiwyg\638x372_co_ar_tr_85\filename.jpg

Suggest changing DIRECTORY_SEPARATOR to just use '/' for full OS support.

Shall I do a PR for this?

Feature request: CMS syntax support

Hi, it would be awesome to use the cms syntax for image processing.. some kind of this:

<img src="{{staempflimage src="media/wysiwyg/image.png" image-resize="200x" image-quality="75" }}">

Original Image is used when using CDN

Yesterday we switched to a CDN (Cloudfront). It works fine but the resized images via this module are wrong. It is always outputting the original image path, which leads to a page speed disaster right now.

Updated to latest version 2.0.2
Magento 2.2.4
PHP7
Varnish
Nginx

Expected Output:

<img src="https://d2rblablablaqf.cloudfront.net/staempfli_imageresizer/cache/catalog/category/182x182_co_ar_tr/niceimage.png" >

Actual Output

<img src="https://d2rblablablaqf.cloudfront.net/catalog/category/niceimage.png" />

Feature request: Add more methods to the interface

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() ?: '';
    }
}

fopen with url error

Hi,

I updated your extension to 2.1.0 and I had problem in the frontend by every category page:
(I use Magento Community Edition 2.2.7.)

2019-03-18 09:54:58] main.CRITICAL: Warning: fopen(<<url>>): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in <<url>>/src/vendor/staempfli/magento2-module-image-resizer/Model/Resizer.php on line 315 [] []

I think: $filepointer = fopen($file, "rb"); fopen with urls is usaually disallowed on productions servers

With the version 2.0.3 I don't have problem.

Can you fix it?

Best regards,
Adam

Feature Request: Widget

First of all, thanks for this module.
It was wonderful when turning category images into responsive images with srcset and sizes attributes.

One thing that I would love to see is the feature to use it outside of templates, but as widget in the admin section.

isAnimatedGif fails on local domain

My development setup is based on Valet Plus. Local usage of this module results in this error:

[2020-01-20 09:18:12] main.ERROR: Staempfli_ImageResizer: could not find image: 
Warning: fopen(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in vendor/staempfli/magento2-module-image-resizer/Model/Resizer.php on line 318 [] []

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.