1

All assets on my website work properly, however I cannot resolve an issue with Imager plugin on a single page template.

My template:

    {% set profileImage = entry.user.photoUrl('original') %}
    {% set transform = {width: 90, height: 90, effects: { grayscale: true, gamma: 1.2 } } %}
    {% set transformedImage = craft.imager.transformImage(profileImage, transform|merge({width: 180, height: 180})).getUrl() %}

        {% if profileImage %}
            <figure>
                <span style="background-image: {{transformedImage}}">
                    <img src="{{ transformedImage }}"/>
                </span>
            </figure>
        {% endif %}

When I try to open a page which uses this template I got the Craft Exception:

cURL error “7” encountered while attempting to download “http://127.0.0.1:8001/cpresources/[...]/myImage.jpg/?d=1553875482”. The error was: “Failed to connect to 127.0.0.1 port 8001: Connection refused”

But when I open the image link directly it works normally. Checked permissions many times. What can be an issue here?

Thanks

5
  • When you open “http://127.0.0.1:8001/cpresources/[...]/myImage.jpg/?d=1553875482 directly it works? – Brad Bell Jul 25 '19 at 22:43
  • Yes, it does. That's why I'm not quite sure what's the issue – krzk Jul 25 '19 at 23:05
  • Several things here to try: stackoverflow.com/questions/22952676/… – Brad Bell Jul 25 '19 at 23:10
  • Thank you very much!! That was the case - I removed ::1 localhost from my /etc/hosts and boom - everything works just fine! – krzk Jul 26 '19 at 10:20
  • Awesome... would you mind adding what worked for you as an official answer in case it ends up helping someone in the future? – Brad Bell Jul 26 '19 at 18:05
1

Ok, so @brad-bell suggested a fix and the solution was to disable ::1 localhost rule from my /etc/hosts file. After that change all images are working properly.

More details can be found here https://stackoverflow.com/questions/22952676/curl-failed-to-connect-to-localhost-port-80

Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.