Web Services 嵌入问题

nfg76nw0  于 2022-11-15  发布在  其他
关注(0)|答案(4)|浏览(168)

我需要在一个网站中嵌入一个issuu文档。应该允许网站管理员决定在前端显示哪个文档。
这是一个简单的任务,使用issuu页面上的嵌入链接。但我需要自定义一些选项-例如,禁用共享,设置维度等。我不能依赖管理员在每次需要更改文档时都执行此过程。
我可以很容易地根据自己的喜好定制issuu嵌入代码,而我所需要的只是文档id。不幸的是,文档的issuu页面中并不包含id。例如,this random link的id恰好是110209071155-d0ed1d10ac0b40dda80dad24166a76ee,它在URL中和页面中都找不到。您必须深入研究嵌入代码才能找到它。
我以为issuu API可以让我得到一个给定URL的文档ID,但是我找不到这样的东西。最接近的匹配是搜索API,但是如果我使用search for the exact name of the document,我只能得到一个不同文档的匹配!
有没有一些简单的方法可以嵌入一个只知道它的URL的文档?或者一个简单的方法可以让一个非技术人员在页面中找到一个文档ID?

euoag5mw

euoag5mw1#

不幸的是,唯一的办法,你可以定制是支付服务,这是39美元为月=/。
您可以使用以下命令强制进入不带广告的全屏模式

<body style="margin:0px;padding:0px;overflow:hidden">        
    <iframe src="YOUR ISSU EMBED" frameborder="0" style="overflow:hidden;height:105%;width:105%;position:absolute;" height="100%" width="100%""></iframe>    
</body>
a0x5cqrl

a0x5cqrl2#

你当然可以嵌入堆栈,但这是不显示在Issuu网站。这是代码(它的旧代码,但它的工作):

<iframe src="http://static.issuu.com/widgets/shelf/index.html?folderId=FOLDERIDamp;theme=theme1&amp;rows=1&amp;thumbSize=large&amp;roundedCorners=true&amp;showTitle=true&amp;showAuthor=false&amp;shadow=true&amp;effect3d=true" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="100%" height="200"></iframe>

FOLDERID是输入堆栈时地址栏上显示的36个字符的数字(例如:https://issuu.com/username/stacks/FOLDERID)。当你在代码中替换它时,你必须粘贴36个字符,格式为8-4-4-4-12,字符之间有-。瞧,它起作用了。你可以在代码中更改主题和其他东西。

goucqfw6

goucqfw63#

文档ID可以在每个文档的HTML源代码中找到。它位于og:video meta属性中。

<meta property="og:video" content="http://static.issuu.com/webembed/viewers/style1/v2/IssuuReader.swf?mode=mini&amp;documentId=XXXXXXXX-XXXXXXXXXXXXX&amp;pageNumber=0">

您可以使用DomDocumentDomXPath php类轻松地处理它。
下面是如何使用PHP:

//  Your document URL
$url = 'https://issuu.com/proyectotres/docs/proyecto_3_edicion_135';

//  Turn off errors, loads the URL as an object and then turn errors on again
libxml_use_internal_errors(true);   
$dom = DomDocument::loadHTMLFile($url);
libxml_use_internal_errors(false);

//  DomXPath helps find the <meta property="og:video" content="http://hereyoucanfindthedocumentid?documentId=xxxxx-xxxxxxx"/> 
$xpath = new DOMXPath($dom);
$meta = $xpath->query("//html/head/meta[@property='og:video']");

//  Get the content attribute of the <meta> node and parse its query
$vars = [];
parse_str(parse_url($meta[0]->getAttribute('content'))['query'], $vars);

//  Ready. The document ID is here:
$docID = $vars['documentId'];

// You can print it:
echo $docID;

您可以尝试使用您自己的Issu文档的URL。

6yjfywim

6yjfywim4#

您可以使用文档的Issuu URL来完成此iframe:

<iframe width="100%" height="283" style="display: block; margin-left: auto; margin-right: auto;" src="https://e.issuu.com/issuu-reader3-embed-files/latest/twittercard.html?u=nantucketchamber&amp;d=program-update1&amp;p=1" frameborder="0" allowfullscreen="allowfullscreen" span="" id="CmCaReT"></iframe>

您只需要在Issuu URL中用用户名替换“nantucketchamber”,用文件名替换“program-update 1
(for本例中URL为https://issuu.com/nantucketchamber/docs/program-update1

相关问题