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

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

Comments

Projects
None yet
3 participants
@kleisauke
Member

kleisauke commented Feb 12, 2017

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

This comment has been minimized.

Show comment
Hide comment
@hakimihamdan88

hakimihamdan88 Mar 5, 2017

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

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 and removed under-review labels Mar 12, 2017

@kleisauke kleisauke added this to the v3.0.0 milestone Mar 12, 2017

@andrieslouw

This comment has been minimized.

Show comment
Hide comment
@andrieslouw

andrieslouw Mar 28, 2017

Member

&errorredirect added, documentation to be written..

Member

andrieslouw commented Mar 28, 2017

&errorredirect added, documentation to be written..

kleisauke added a commit that referenced this issue Jun 1, 2017

Document recently added parameters + more
- 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 and removed started labels Jun 10, 2017

@andrieslouw

This comment has been minimized.

Show comment
Hide comment
@andrieslouw

andrieslouw Jun 10, 2017

Member

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

Member

andrieslouw commented Jun 10, 2017

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