Задайте вопросы о том, как захватывать или конвертировать веб-страницы или HTML into изображения, CSV, PDF или DOCX документы, а также о том, как конвертировать видео into анимированные GIF с использованием нашего API.
Здравствуйте,
I'm a paying customer trying to get a screen shot of a <div> element containing a tweet embed overlayed with a watermark. Проблема в том, что я получаю скриншот только watermark. Here is my code... what am I doing wrong?
#tweet {
позиция: относительная;
z-index: 1! важный;
ширина: 500px! важно;
поле слева: -8px;
маржа сверху: -10 пикселей;
}
.watermark {
положение: абсолютное;
топ: 60px;
Слева направо: 100px;
z-index: 10! важный;
display: <?php if($_GET['watermark'] == 0){ $watermark = "none"; } elseif($_GET['watermark'] == 1){ $watermark = ""; } echo $watermark; ?>;
}
#tweet iframe {
граница: нет !важно;
box-shadow: none !important;
}
.copywrite p {
положение: абсолютное;
Слева направо: 0;
маржа сверху: -9 пикселей;
font-family: Gotham, "Helvetica Neue", Helvetica, Arial, "sans-serif";
размер шрифта: 12px;
color:#a2a6a8;
}
<title>Tweet Screen Shot Feeder</title>
<script src="https://cdn.jsdelivr.net/npm/@grabzit/js@3.4.7/grabzit.min.js"></script>
<div class="tweet-wrapper" id="content">
<div id="tweet" tweetID="<?php echo $_GET["tweetid"];?>"></div>
<!-- <div id="tweet" tweetID="1223594060818059264"></div> -->
<img src="images/watermark.png" class="watermark"/>
<div class="copywrite">
<p>Tweet screen shot by <strong>https://sane.social</strong> © on <?php echo date("M. d, Y") . "<br>";?></p>
<script sync src="https://platform.twitter.com/widgets.js"></script>
window.onload = (function(){
var tweet = document.getElementById("tweet");
var id = tweet.getAttribute("tweetID");
twttr.widgets.createTweet(
id, tweet, {
conversation : 'none', // or all
cards : 'visible', // or visible
theme : 'light' // or dark
})
.then (function (el) {
el.contentDocument.querySelector(".footer").style.display = "none";
});
});
<div id="tweetshot"></div>
GrabzIt("XXXX=").ConvertPage(window.location.href, {"target": "#content", "bheight": -1, "height": -1, "width": -1}).AddTo("tweetshot");
I don't think this is an issue with GrabzIt but with the security of Twitters API. It probably doesn't like being used inside a temporary HTML page. Instead you should change your code to use the URL instead:
.ConvertURL(location.href, {"target": "#content", "bheight": -1, "height": -1, "width": -1}).AddTo("tweetshot");