首页 \ 问答 \ 使用putObject重定向的aws s3元标记(aws s3 meta tag for redirect using putObject)

使用putObject重定向的aws s3元标记(aws s3 meta tag for redirect using putObject)

这是成功创建对象,但我在编写网站重定向的元标记时遇到问题。

有人有这个成功吗?

$result = $client->putObject(array(
    'Bucket' => $hello,
    'Key'    => $hellokey,
    'Body'   => 'the body',
    'ContentType' => 'text/html',
    'Metadata'   => array(
       'Website Redirect Location' => 'http://www.cnn.com/'
    )
));

This is successfully creating the object, but I am having trouble writing the meta tag for website redirect.

Has anybody had success with this?

$result = $client->putObject(array(
    'Bucket' => $hello,
    'Key'    => $hellokey,
    'Body'   => 'the body',
    'ContentType' => 'text/html',
    'Metadata'   => array(
       'Website Redirect Location' => 'http://www.cnn.com/'
    )
));

原文:https://stackoverflow.com/questions/18246226
更新时间:2022-03-21 09:03

最满意答案

更新:在至少Chrome( https://code.google.com/p/chromium/issues/detail?id=231577 )中,此行为似乎存在活动错误,并且也适用于Firefox( https:// bugzilla.mozilla.org/show_bug.cgi?id=378923 )。 所以根据版本你可能会运气不好。 在编写时,这在Chrome(32.0.1700.6 beta)中没有修复,你可以用这个小提琴来测试: http//jsfiddle.net/HRsvX/36/如果浏览器应该完全可见所有三个三角形实现当前的SVG 1.1规范。 小提琴转载如下。

圆内部区域与SVG元素接壤。 在HTML5t之前,SVG元素本身就像是一个图像或flash电影,它不能溢出到html文档中,它有自己的画布可以这么说。 当您添加笔划(默认情况下位于您定义的区域之外)时,笔划将最终位于SVG画布之外。 你必须在圆圈的中心考虑到这一点:

中心必须是半径+行程宽度,因此您的中心x必须至少为164.041666625656 + 5.291666665343749才能完全适合SVG内部。

如果您在示例中指定HTML5 doctype并使用内联SVG,则应显示溢出内容,因为溢出的默认值是可见的,HTML5允许内联SVG元素溢出。

因此,要么检查您的doctype,要么重新定位中心以考虑笔划宽度。

有关SVG元素溢出的更多信息可以在Mozilla开发人员文档中找到, 这篇MSDN博客上的一篇很好的文章解释了默认溢出。

HTML

<div><svg height="100" width="100" viewbox="00 0 100 100">
  <path d="M210 10 L90 10 L90 90 " fill="red"/>
</svg></div>

<div><svg id="clip1" height="100" width="100" viewbox="00 0 100 100">
  <path d="M210 10 L90 10 L90 90 " fill="red"/>
</svg></div>

CSS

div {
    height:100px; width:100px;
    margin:1em auto;
    border: solid 1px black;
}

svg { overflow:visible }

#clip1 {clip: rect(-10px,-10px,-10px,-10px)} //nope
#clip2 {clip: auto} //nope

UPDATE: Looks like there are active bug for this behaviour in at least Chrome (https://code.google.com/p/chromium/issues/detail?id=231577) and has been for Firefox as well (https://bugzilla.mozilla.org/show_bug.cgi?id=378923). So depending on version you might be out of luck. As of writing this is not fixed in Chrome (32.0.1700.6 beta) and there is a fiddle you can use to test with here: http://jsfiddle.net/HRsvX/36/ all three triangles should be fully visible if the browser implements the current SVG 1.1 spec. Fiddle reproduced below.

The circle inner area is bordering the SVG element. Before HTML5t the SVG element itself is like an image or flash movie, it can't overflow into the html document, it has it's own canvas so to speak. When you add stroke (that by default is outside the area you defined) the stroke will end up outside the SVG canvas. You'll have to account for that in the centering of the circle:

The center has to be the radius+stroke width so your center x for example would have to be 164.041666625656 + 5.291666665343749 minimum to fully fit inside the SVG.

If you specify the HTML5 doctype and use an inline SVG as in your example it should show the overflowing content since the default value for overflow is visible and HTML5 allows for overflow on inline SVG elements.

So either check your doctype or reposition the center to account for the stroke width.

More on the overflow of SVG elements can be found in Mozilla developer documents and a nice piece on this MSDN blog that explains the default overflow.

HTML

<div><svg height="100" width="100" viewbox="00 0 100 100">
  <path d="M210 10 L90 10 L90 90 " fill="red"/>
</svg></div>

<div><svg id="clip1" height="100" width="100" viewbox="00 0 100 100">
  <path d="M210 10 L90 10 L90 90 " fill="red"/>
</svg></div>

CSS

div {
    height:100px; width:100px;
    margin:1em auto;
    border: solid 1px black;
}

svg { overflow:visible }

#clip1 {clip: rect(-10px,-10px,-10px,-10px)} //nope
#clip2 {clip: auto} //nope

相关问答

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)