Active
Project:
Embedded Media Field
Version:
6.x-1.x-dev
Component:
Embedded Image Field
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Feb 2009 at 08:43 UTC
Updated:
26 Nov 2009 at 19:58 UTC
Jump to comment: Most recent file
Comments
Comment #1
davidhk commentedComment #2
davidhk commentedPlease ignore the previous patch, it doesn't work. Here's the function I've changed. The problem is that the call to getimagesize is returning false, though the url seems to be right, eg
"http://farm4.static.flickr.com/3297/3236587333_3f71cdf1e9_o.jpg"
Any ideas why getimagesize doesn't work, or ideas of other ways to find the image's dimensions?
Comment #3
davidhk commentedThe following code works (it uses curl instead of getimagesize), but fetching the image every time it is displayed is a bit crazy. Any suggestions on the right way to approach this?
I'm thinking to have theme_emimage_image just look in $item for width and height entries, and have emfield_PROVIDER_data responsible for setting those values when the node is initially created. It looks like picasa.inc already does this. Does that sound right?
Comment #4
smooshy commentedsubscribe
Comment #5
davidhk commentedThis works for me - please can you let me know if it's ok for you too.
The first patch is to theme_emimage_image in emimage.theme.inc. This version looks to see if emfield_PROVIDER_data had set values for the image's height & width, and if yes it scales the image to fit within the specified size, while preserving its aspect ratio. If they are not set, it behaves like the current beta1 version.
The second patch is to flickr.inc, so that it sets the height & width required above.
If you have an existing embedded flickr image, you'll need to edit & save it (no need to make any changes) before you see the effects of these patches.
Comment #6
davidhk commentedComment #7
stormsweeper commentedgetimagesize will fail if your PHP doesn't have zlib compiled in. If you enable NOTICE logging you should see the exact message. To confirm, go to your Drupal status page, and then click on the PHP version and look at compile flags.
Comment #8
jcmarco commentedTry with this other patch:
#416790: Fixed bug in widget form that break aspect ratio configuration
Comment #9
alex ua commentedShould now be fixed. See the issue linked to in #8
Comment #10
davidhk commentedHi, moving this back to active, as the problem & patch I'm describing are different from that in #8. I'll try and explain it better.
I want to use Views to build a gallery of emfield images, and have it display as a grid of images, just like any other gallery you see on the web.
I set the dimensions of the thumbnail to be 150x150. See 150x150-org.jpg. That shows a grid, but all images are stretched to fit the 150x150 square shape, so they are distorted.
I read that setting one dimension to 0 preserves the aspect ratio, so I tried dimensions of 150x0. See 150x0-org.jpg. Now the images looks ok, but the gallery looks wrong. Portrait images always appear much larger than landscape images, not how a gallery usually looks.
So, the patch in #5 preserves the aspect ratio, AND fits the image within the specified dimensions. After installing the patch, and setting the dimensions to 150x150 we get 150x150-patch.jpg, which I think looks better.
Comment #11
alex ua commentedI'm comitting this right now. Thanks for the fix!
Comment #12
jcmarco commentedI found some typos when last patches were committed into the module, it seems that there are some lost lines.
Also found problems with Flickr when the $item['data'] is serialized so the "square" escalation was not possible.
Once fixed the lost lines in the emimage.theme.inc and fixed the issue with the serialized data, the patch worked genially.
Allowing working in both ways with an automatic size adaptation (using 0 in some dimension) or defining a "squared" max dimensions.
I couldn't test it with other image providers than Flickr.
Comment #13
alex ua commentedVery odd. Yesterday I had this working, without your most recent patch. I just added the patch, and now everything is getting stretched again. Is there anything else missing?
Comment #14
smazsyr commentedUsing the dev version, which I think has the latest patches, I receive the following error upon saving, and on displaying a node with an embedded image from Flickr:
warning: Division by zero in /home/thenew/public_html/sites/all/modules/emfield/contrib/emimage/emimage.theme.inc on line 15.
Comment #15
aaron commentedFixed the division by zero error. Not sure if there's anything else here that needs attention?
Comment #16
aaron commentedOK, Fixed the thing entirely now. Should work fine.
Comment #18
srobert72 commentedI'm using Emfield 6.x-1.x-dev (2009-Aug-26)
I'm facing issue described in #10 (http://drupal.org/node/383274#comment-1514208)
All is like if patch doesn't operate.
I'd want to set width and height so that depending on image orientation (lanscape or portrait) width and height both never exceed certain length. All that respecting aspect ration.
By example I set 150x150 so that :
original image 400x200 is resized 150x75
original image 200x400 is resized 75x150
For me with Emfield 6.x-1.x-dev (2009-Aug-26) it doesn't appear like it would need as mentionned on attached picture : http://drupal.org/files/issues/150x150-patch.jpg
Is the patch commited in dev release ?
Comment #19
cloneofsnake commentedHaving the same problem, and this seems like a trivial thing. The settings should be:
Max Height:
Max Width:
Keep Aspect Ration (checkbox)
Checkbox should default to checked.
Comment #20
Sylvain Lasnier commentedHi,
I have same problem with other dimension. 1024px × 682px image is scaling to 500px × 800px.
Comment #21
Sylvain Lasnier commented"keep aspect ratio" or "crop" will be perfect.
Comment #22
srobert72 commentedSubscribing again