我知道这个问题经常被问到,但我还没有找到解决方案.我用这个代码:
打开html标签
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#">
Run Code Online (Sandbox Code Playgroud)
在我开始标记后的索引中我输入了这个
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : 'MY_APP_ID', // App ID from the app dashboard
status : true, // Check Facebook Login status
xfbml : true // Look for social plugins on the page
});
// Additional initialization code such as adding Event Listeners goes here
};
// Load the SDK asynchronously
(function(){
// If we've already installed the SDK, we're done
if (document.getElementById('facebook-jssdk')) {return;} …
Run Code Online (Sandbox Code Playgroud) 由Google翻译
我正在运行以在php和jquery中实现上传表单,并说现在一切都很好,除了一件我认为是无稽之谈但仍然无法解决的问题.让我解释一下:在实际操作中,当我运行图像上传时,我立即打印到屏幕上是一个临时预览,我将去那里剪切我喜欢的图像,然后保存缩略图.然而,这个预览,如果我插入jpg高分辨率我看到真人大小,所以页面太大了.代码如下:
的index.php
<?php
function uploadImageFile() { // Note: GD library is required for this function
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$iWidth = $iHeight = 100; // desired image result dimensions
$iJpgQuality = 90;
if ($_FILES) {
// if no errors and size less than 250kb
if (! $_FILES['image_file']['error'] && $_FILES['image_file']['size'] < 55555250 * 1024) {
if (is_uploaded_file($_FILES['image_file']['tmp_name'])) {
// new unique filename
$sTempFileName = 'cache/' . md5(time().rand());
// move uploaded file into cache folder
move_uploaded_file($_FILES['image_file']['tmp_name'], $sTempFileName);
// change file …
Run Code Online (Sandbox Code Playgroud)