# \[bounty\] Google+ (private ) communities: export screenscraper + importer

**URL:** <https://meta.discourse.org/t/bounty-google-private-communities-export-screenscraper-importer/108029>\
**Category:** Marketplace\
**Created:** [31 בינואר,‏ 2019,‏ 3:40pm UTC](https://meta.discourse.org/t/bounty-google-private-communities-export-screenscraper-importer/108029 "2019-01-31T15:40:04Z")\
**Posts on this page:** 1\
**Showing post:** 43

<div class="post-metadata">

**Author:** ![mcdanlj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcdanlj/32/131829_2.png) [@mcdanlj](https://meta.discourse.org/u/mcdanlj)\
**Post date:** [5 במרץ,‏ 2019,‏ 12:08am UTC](https://meta.discourse.org/t/bounty-google-private-communities-export-screenscraper-importer/108029/43 "2019-03-05T00:08:23Z")

</div>

I am pretty sure that I had rebased on master well before I ran that import. Reading the code, the bug is in `embedded_image_html` which doesn’t preserve aspect ratio:

```plaintext
    def embedded_image_html(upload)
      image_width = [upload.width, SiteSetting.max_image_width].compact.min
      image_height = [upload.height, SiteSetting.max_image_height].compact.min
      upload_name = upload.short_url || upload.url
      %Q~![#{upload.original_filename}|#{image_width}x#{image_height}](#{upload_name})~
    end

```

There’s not any multiplication or “square rootification” in there anywhere. About 20 years ago, my quick hack shell script to create indexes of images did this:

```plaintext
        eval $(identify -format 'OLDWIDTH=%w;OLDHEIGHT=%h' $file)
        NEWWIDTH=$(echo "sqrt(($AREA*$OLDWIDTH)/$OLDHEIGHT)" | bc)
        NEWHEIGHT=$(echo "sqrt(($AREA*$OLDHEIGHT)/$OLDWIDTH)" | bc)
        THIS_GEO="${NEWWIDTH}x${NEWHEIGHT}>"

```

That formula is a few millennia old, so I don’t claim any credit, and similar logic could keep aspect ratio while honoring the most restrictive constraint.

---

_[View the full topic](https://meta.discourse.org/t/bounty-google-private-communities-export-screenscraper-importer/108029)._
