Basic Google Maps Placemarks
[resolved] Icon sizes (5 posts)

  1. steacha
    Posted 1 year ago #

    Hi there,

    This is an swesome plugin, Ian, great job!

    I have a little problem, however. I used my own icons as place markers, and for some reasons, they are getting resized to a size bigger than their original size that makes them look pixelated.

    I've read the FAQ and did a search here, but couldn't find a support answer that fixed my problem. Is there a parameter I can pass to the shortcode so that it keeps the original size of the icon I use as Featured Image? Right now, it's loading the 150x150 pixels version of my marker. How do I prevent this from happening?


  2. Gillian
    Posted 1 year ago #

  3. steacha
    Posted 1 year ago #

    I did read this thread, actually.

    And, the icon links look like this for me:

    <path to uploads directory>/marker-image.png-150x150.png

    No resize is in the URL. I am not using JetPack or Photon.

  4. steacha
    Posted 1 year ago #

    Ok, well I solved my problem.

    In line 2517 in core.php, the custom marker is extracted with the following function call:

    $icon = wp_get_attachment_image_src( get_post_thumbnail_id( $postID ));

    This will return the 'thumbnail' size that is configured within WordPress (in Settings > Media). This 'thumbnail' dimension applies to ALL thumbnails that WP automatically generates for all uploaded images. It can be anything and NOT necessarily match the size of the custom markers.

    The fix is easy, though. Just change the line to the following:

    $icon = wp_get_attachment_image_src( get_post_thumbnail_id( $postID ), "full" );

    This way, WP is forced to send the ORIGINAL size of the image. I think you should consider adding this fix to the plugin, Ian. Or, at least, a parameter to the shortcode to instruct the plugin to use custom sizes or WP-generated 'thumbnail' dimensions.

  5. Ian Dunn
    Plugin Author

    Posted 1 year ago #

    I think thumbnail is the most sensible default for most users, and changing it would break backwards-compatibility.

    I've added a new filter in r829103, though, so you can change it without modifying the plugin's files.

    It's in trunk now, and will be in the next release.

    function set_bgmp_icon_size( $size ) {
    	return 'full';
    add_filter( 'bgmp_featured-icon-size', 'set_bgmp_icon_size' );

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic