sureshvv / plonegomobile

Automatically exported from code.google.com/p/plonegomobile
0 stars 0 forks source link

TinyMCE in Plone4.1 uses @@images scales which break the unrestrictedTraverse in the ImageProcessor #29

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a page, insert an image using TinyMCE
2. The image reference will be myimage.png/@@images/image/mini
3. View the page through the mobile url (m.mysite.com)

You would expect to see the scaled image but you get an error with following 
traceback:

[..]
Module gomobile.mobile.browser.imageprocessor, line 335, in getImageDownloadURL
Module gomobile.mobile.browser.imageprocessor, line 290, in mapURL
Module OFS.Traversable, line 255, in unrestrictedTraverse
__traceback_info__: (['mini'], 'image')
TypeError: 'ImageScaling' object is unsubscriptable

What version of the product are you using? On what operating system?
Plone4.1 with gomobile

Please provide any additional information below.

The reason is that imageObject = context.unrestrictedTraverse(url) cannot 
traverse through the ImageScaling Adapter.

It is possible to avoid the problem by catching urls containing @@images like 
this to throw the scaling away:

if "@@images" in url:
    url = url[:url.index('@@images')]

But I am not sure if this is the correct approach.

Original issue reported on code.google.com by alex.p...@gmail.com on 1 Jul 2011 at 3:36

GoogleCodeExporter commented 9 years ago
I have also experienced this issue on Plone 4109 with mfabrik.webandmobile 
1.0.6.

I added the 'if "@@images"...' check suggested by Alex in the original issue 
report above.  It does allow the images to be displayed on the mobile site.

Awaiting word...

Original comment by br...@huron-data.com on 14 Sep 2011 at 7:03

GoogleCodeExporter commented 9 years ago
This would require a special case creation for for plone.app.scaling so that we 
could extract image information correctly for the scaling.  We are not 
currectly experiencing the issue on our own sites - I hope someone could step 
up and create a patch for image resizer URL mapper. I can provide necessary 
guidance if needed. It would be probably 1-2 hours of work.

:(

We also need to craete a special case for resolveUID images (link by UID 
setting) in TinyMCE.

Original comment by mioht...@gmail.com on 14 Sep 2011 at 7:29

GoogleCodeExporter commented 9 years ago
I'm also getting this error on Plone 4.2a1. Using the fix given by Alex the 
mobile page is rendered correctly. 

Here's the patch: http://pastebin.com/G5wuRigS

Original comment by kaceeleong@gmail.com on 3 Jan 2012 at 10:18