Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi again,

    The memory limitation is one of a number of things, depending on your setup. Google, mainly, and perhaps your local PHP configuration (especially if using the Enhanced Viewer). There is no “magic number” that is a file too big. It seems to vary from 7-12MB, generally.

    Your best option is to optimize your embedded documents for web use. If you’re embedding a PDF, you only need to have the document at a screen resolution, not print-ready. This should result in a small enough file even on very large and graphics intensive documents. Then, if you need to allow download of a “higher resolution” version as well, you can add that link without embedding it.

    In short, Google’s viewer can’t handle large files due to the nature of how it operates. You must adequately compress the files to have good results. Since I don’t have access to the file size limit, and it varies from place to place based on configuration and network condition, I’m not sure how I can account for this in the plugin.

    If I have misunderstood your question/request, please let me know.

    Thanks,

    Kevin

    Thread Starter mrhaanraadts

    (@mrhaanraadts)

    Dear Kevin,

    We have a website that makes manuals easy accessible. This means that there are thousands of pdf files embedded. You will understand that it is nog practical to check every manual by hand.

    The solution i thought of is letting the plugin check the file size and if the file is larger than for example 10MB, automatically not embedding the file but show some text and the download link.

    As i see it, it’s just another else/if statement. I just don’t know where and how to implement it.

    Thanks

    I understand better what you’re saying now. However, I hesitate to implement this suggestion for a number of reasons. I don’t think this option would be generally helpful for the vast majority of the users of the plugin. Also, the maximum file size is a moving target from site to site, as mentioned above, and perhaps even impossible to determine accurately. (In your suggested scenario, it’s possible that files of 9MB would still appear but not work.) To make matters worse, some servers are configured in such a way that I don’t have a 100% reliable method of obtaining the file size in the first place.

    Here’s a hint toward implementing it yourself, though, if you’re interested in trying it. Find this block of code in gviewer.php (currently around line 70):

    $fsize = gde_formatBytes($status['fsize']);
    
    		$code =<<<HERE
    %A%
    <iframe src="%U%" class="gde-frame" style="width:%W%; height:%H%; border: none;" scrolling="no"></iframe>\n
    %B%
    HERE;

    and try replacing these relevant portions:

    $fsize = gde_formatBytes($status['fsize']);
    
    		$max_mb_size = '10'; // set max size to display (in MB)
    
    		if ($status['fsize'] > $max_mb_size*1024*1024) {
    			$code = "%A% File too large to embed.\n %B%";
    		} else {
    			$code =<<<HERE
    %A%
    <iframe src="%U%" class="gde-frame" style="width:%W%; height:%H%; border: none;" scrolling="no"></iframe>\n
    %B%
    HERE;
    		}

    You can of course change the text to your liking, or just remove it, but the %A% and %B% show the download link (depending on whether you’ve set the position to above or below the viewer) so you’ll want to leave one or both of these.

    Let me know if you need more help. I’ll keep considering if this idea is something that should be implemented into the plugin as a setting in the future.

    Kevin

    Thread Starter mrhaanraadts

    (@mrhaanraadts)

    I saw that you implemented an option for the max file size in the latest update.
    Thanks

    You’re welcome, thanks for the idea. You can see it grew on me ??

    In a coming version I plan to allow you to show just one page only (as a standalone image) if the max file size is exceeded, rather than blocking the preview entirely.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Google Doc Embedder] File size’ is closed to new replies.