Skip to content

Commit

Permalink
Rewrite resizer so it works on webkit
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt committed Feb 1, 2011
1 parent cb70d42 commit 17e7b17
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion index.php
Expand Up @@ -17,7 +17,7 @@
-->

<img id="testthing" src="flickr://taylor swift" width="600px" height="400px" />
<img id="testthing" src="flickr://taylor swift" width="600px" height="600px" />

<!-- <img src="flickr://dogs and cats" data-width="200" data-height="400" /> -->

Expand Down
12 changes: 6 additions & 6 deletions public/js/views/imageview.js
Expand Up @@ -10,6 +10,8 @@ define(['models/image', 'views/flickrimageview'], function (Image, FlickrImageVi
initialize: function (options) {
_.bindAll(this, 'addImage', 'updateSrc', 'setDimentions', 'updateDimentions');
var keywords = options.img.attr('src').replace('flickr://', '');

this.$el = $(this.el);

this.image = new Image({keywords: keywords, id: options.img.attr('id')});
this.image.flickrImages.bind('add', this.addImage);
Expand Down Expand Up @@ -39,11 +41,9 @@ define(['models/image', 'views/flickrimageview'], function (Image, FlickrImageVi
},

setDimentions: function (event) {
// console.log($(event.target).width());
// console.log($(event.target).height());
this.image.set({
width: $(event.target).width(),
height: $(event.target).height()
width: this.$('img').width(),
height: this.$('img').height()
});
this.updateDimentions(this.image);
$(event.target).unbind('load');
Expand All @@ -54,8 +54,8 @@ define(['models/image', 'views/flickrimageview'], function (Image, FlickrImageVi
flickrWidth = this.image.get('width'),
flickrHeight = this.image.get('height'),
flickrAspectRatio = flickrWidth / flickrHeight,
clientWidth = this.width(),
clientHeight = this.height(),
clientWidth = this.$('div.flickrbombWrapper').width(),
clientHeight = this.$('div.flickrbombWrapper').height(),
clientAspectRatio = clientWidth / clientHeight;

if (flickrAspectRatio < clientAspectRatio) {
Expand Down

0 comments on commit 17e7b17

Please sign in to comment.