I am actually using 7.x-2.x from October 30, 2013. I have added a File field as Media file selector for my Issuu. The allowed type is Document and URI scheme is issuu.

The display is Rendered file and view mode is Original. Under admin/structure/file-types/manage/document/file-display, I expected to see "Issuu document" or something as a display.

I am using Media 7.x-2.0-alpha3. Any help would be appreciated!

CommentFileSizeAuthor
#6 media_issuu_redirect.patch1.32 KBmichaelk
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

MrPeanut’s picture

I updated every module (Drupal core and Media) and am now able to get the documents to load. However, they don't seem to be using the values I thought I set.

For example, on Manage Display for my content type, I have chosen Rendered file and Original for the View mode.

On admin/structure/file-types/manage/document/file-display/media_original, I set Original to load Issuu Document and set my dimensions. However, the node does not use those dimensions.

For what it's worth, I set Link to Issuu Preview Image and it does seem to work. In my case, it loads my thumbnail_135px image style.

mallezie’s picture

Category: Support request » Bug report

This needs more work in the theme file

/**
 * Preprocess function for theme('media_issuu_document').
 * @todo This function needs to be completed to add all the parameters used 
 * in the media-issuu-document.tpl file. 
 */
function media_issuu_preprocess_media_issuu_document(&$variables) {
    //add embed javascript
  drupal_add_js('http://e.issuu.com/embed.js', 'external');
  
  $variables['width'] = isset($variables['width']) ? $variables['width'] : media_issuu_variable_get('width');
  $variables['height'] = isset($variables['height']) ? $variables['height'] : media_issuu_variable_get('height');
  $variables['fullscreen'] = isset($variables['fullscreen']) ? $variables['fullscreen'] : media_issuu_variable_get('fullscreen');
  $variables['fullscreen'] = $variables['fullscreen'] ? 'true' : 'false';
  
  $response_with_id = drupal_http_request("http://issuu.com/" . substr($variables['uri'], 8) . '?mode=a_p&wmode=0');
  $url_with_id = $response_with_id->redirect_url;
  $url_array = parse_url($url_with_id);
  parse_str($url_array['query'], $query_array);
  $variables['config_id'] = $query_array['e'];
}

I'll hope te get some results in the coming weeks, since i need this fix myself.

mallezie’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
michaelk’s picture

I am also running into this issue on a site that was already working well several months ago. The issue appears to be that drupal_http_request no longer returns a redirect_url field for some reason. Here are the error message I am seeing in my site logs:

Notice: Undefined property: stdClass::$redirect_url in media_issuu_preprocess_media_issuu_document() (line 24 of /sites/all/modules/contrib/issuu/media_issuu/includes/themes/media_issuu.theme.inc).

Notice: Undefined index: query in media_issuu_preprocess_media_issuu_document() (line 26 of /sites/all/modules/contrib/issuu/media_issuu/includes/themes/media_issuu.theme.inc).

Notice: Undefined index: e in media_issuu_preprocess_media_issuu_document() (line 27 of /sites/all/modules/contrib/issuu/media_issuu/includes/themes/media_issuu.theme.inc).

michaelk’s picture

Priority: Normal » Critical
michaelk’s picture

FileSize
1.32 KB

Here is a patch that solves the issue by changing the method used to determine the Issuu document id from the uri. Give it a try and see if it solves the issue for you as well.

michaelk’s picture

Status: Active » Needs review
mallezie’s picture

Priority: Critical » Normal
Status: Needs review » Needs work

I pushed a fix for the problem. It seems indeed something fixed from the issuu side.
I implemented another fix, to get away from the config ID search. I found out you can embed issues now with the url, which simplifies the code.
Commit can be seen in http://cgit.drupalcode.org/issuu/commit/?id=4ef9af2
(Never mind the wrong issuu number in the commit, my bad)
Thanks for the help!
Leaving this issue open to look further in the attributes problem described in the OP.

AdmiralSenn’s picture

I have a strange issue that may be related to this. I have already applied the patch from this thread.

On my site, ISSUU documents appear to load and display correctly for several days, sometimes as long as a week, then the document fails to display. It will display a link to the ISSUU document, but the embedded viewer is missing. The source for the page does not show the iframe at all.

The page in question was displaying through a View using 'rendered content'. I have switched the view to use Fields, but in doing so noticed that the error appears exactly as if the ISSUU field is set to 'generic file' instead of 'rendered content'.

I have been unable to get any more information as the problem appears to disappear after caches are cleared, and so far I have not caught it when I'm at a workstation to inspect further. I have gotten screenshots from a few people on the site that show the same problem so it does seem to be an issue with the site vs. a browser or OS problem.

I will update if the issue happens using fields instead of rendered content.

AdmiralSenn’s picture

Addendum to previous post, using Fields does not seem to make a difference.

Also, the module seems to be picky about the URL used to refer to an ISSUU document.

If you use the 'share' link from your issuu document (e.g. http://issuu.com/youraccount/docs/pdf_name_here_issuu_randomidentifierst...

vs

http://issuu.com/youraccount/docs/pdf_name_here_issuu

the first one works occasionally but the second one seems to work more reliably. Perhaps the module should check for and strip that section of the URL? Or maybe there's something else going on.

Is there any chance that someone can write an updated how-to for this so I can make sure I'm not being stupid and doing this wrong?

liquidcms’s picture

Does anyone know if this works? Or maybe it used to but doesn't anymore?

I used field type: file, i know it scrapes something because when i add the Issuu url since it pulls the title for "Name". I am not sure what the proper formatter is but i don't seem to have anything like "Issuu" as a formatter so i use Rendered File. The output is simply a generic file icon with the title Issuu document title, linked to site home page.

Ludo.R’s picture

@liquidcms: I have the same issue, no issuu-specific formatter is available to display the field.

Did you find a solution?