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

Return default image if the image's URL not found #37

Closed
kleisauke opened this issue Feb 12, 2017 · 4 comments
Closed

Return default image if the image's URL not found #37

kleisauke opened this issue Feb 12, 2017 · 4 comments
Assignees
Labels
completed Feature or request has been completed enhancement New feature or request
Milestone

Comments

@kleisauke
Copy link
Member

Return default image if the image's URL not found [2924913]

Submitted by Alif Alfiandy on 14-6-2012 0:00:00
12 votes on UserVoice prior to migration

Let say if the image from hosting was removed but the image's URL is still in the database, then it will not load the image as the 404 error happens. My idea is, to replace the 404 error with default image so that we will never see the broken image on our website.

Response

by Andries Louw Wolthuizen on 3-3-2014 0:00:00

We will reconsider to implement this like Nick suggested. I don’t know how many changes there are needed in different parts of the proxy to make this work flawless.
In the meanwhile, please use the onerror event on an img-tag ( http://www.w3schools.com/jsref/event_img_onerror.asp ).
See:
http://www.askdavetaylor.com/how_to_display_image_not_found_graphic_html_javascript_onerror.html
Or this stackoverflow-thread about how to handle this in jQuery:
http://stackoverflow.com/questions/92720/jquery-javascript-to-replace-broken-images

Comments

Comment by Andries Louw Wolthuizen (Webmaster, Images.weserv.nl - Image cache & resize proxy) on 14-6-2012 12:54:00

Please use the onerror event on an img-tag ( http://www.w3schools.com/jsref/event_img_onerror.asp ), I cannot keep track of all requested images, nor serve default images on an 404-error, this would change default behaviour of the proxy on which third-party's rely.
See:
http://www.askdavetaylor.com/how_to_display_image_not_found_graphic_html_javascript_onerror.html
Or this stackoverflow-thread about how to handle this in jQuery:
http://stackoverflow.com/questions/92720/jquery-javascript-to-replace-broken-images

Comment by Nick @ www.merq.org on 3-3-2014 11:54:00

I am also interested in this feature. Gravatar has a similar service.
A &errorredirect parameter would be great. If there are errors and this param is set your service could send a redirect to this url with the error id (&error=404).
Example:
http://images.weserv.nl/?url=example.org/noimage.jpg&errorredirect=http%3A%2F%2Fimages.weserv.nl%2F%3Furl%3Dwww.google.nl%2Flogos%2Flogo.gif%26h%3D45
Redirect to:
http://images.weserv.nl/?url=www.google.nl/logos/logo.gif&h=45&error=404
&error=404 is only for information if somebody will show dynamic error images via php.

Comment by Andries Louw Wolthuizen (Webmaster, Images.weserv.nl - Image cache & resize proxy) on 3-3-2014 20:01:00

We will reconsider to implement this like Nick suggested. I don't know how many changes there are needed in different parts of the proxy to make this work flawless.

Original UserVoice Submission

@hakimihamdan88
Copy link

embedly support errorurl parameter, The URL of the fall back image to use when url fails
see http://docs.embed.ly/docs/display

kleisauke added a commit that referenced this issue Mar 6, 2017
@kleisauke kleisauke added started This issue is being worked on and removed under-review labels Mar 12, 2017
@kleisauke kleisauke added this to the v3.0.0 milestone Mar 12, 2017
@andrieslouw andrieslouw added the enhancement New feature or request label Mar 28, 2017
@andrieslouw
Copy link
Member

&errorredirect added, documentation to be written..

@hakimihamdan88
Copy link

hakimihamdan88 commented Mar 30, 2017

@andrieslouw nice https://images.weserv.nl/?url=example.org/noimage.jpg&errorredirect=www.google.nl/logos/logo.gif

kleisauke added a commit that referenced this issue Jun 1, 2017
- Document &errorredirect (see:
#37) and &page
parameters.
- Use multiple arguments for isset.
- Recalculate residual after adjusting shrink (fixes a resize bug).
- Bump Travis libvips to 8.5.5.
@andrieslouw andrieslouw added completed Feature or request has been completed and removed started This issue is being worked on labels Jun 10, 2017
@andrieslouw
Copy link
Member

Documentation has been written: https://images.weserv.nl/#default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completed Feature or request has been completed enhancement New feature or request
Development

No branches or pull requests

3 participants