2013-07-12 48 views
0

大家好,感謝您的幫助。我們的網站Tom's Guide France最近更改了它的標識。 因此,我們更新了我們的og:image meta中沒有特定頁面的圖片文件。 實例網址:http://www.tomsguide.fr/solutions/id-2109117/desimlockage-dallas-urgent.html爲什麼我的og:圖片圖片在Facebook上更新不正確?

爲OG圖片:圖像元如下:http://m.bestofmedia.com/sfp/images/design/logos/fb/tgu_pic.jpg 對我來說,這是一個文字標識與向上/向下箭頭代替字母I

但對於Facebook,這是我們的老徽標,帶着手電筒。

我對這兩個URL都使用了調試器。 但在這兩種情況下,Facebook都會看到我的舊標識。

任何提示?

最佳,

Gzav

回答

0

公共靜態函數resize_img($ srcimg,$ dest_img,$ MAX_WIDTH = 0,$ MAX_HEIGHT = 0){

$save = $dest_img; 
    $src = null; 
    $source_pic = $srcimg; 

    $imageinfo = getimagesize($source_pic); 

    //print_r($imageinfo);die; 
    switch($imageinfo['mime']) 
    { 
    case 'image/png': 
    $src = imagecreatefrompng($source_pic); 
    break; 
    case 'image/jpeg': 
    $src = imagecreatefromjpeg($source_pic); 
    break; 
    case 'image/gif': 
    $src = imagecreatefromgif($source_pic); 
    break; 
    case 'image/x-ms-bmp': 
    $src = imagecreatefrombmp($source_pic); 
    break; 
    } 

     list($width,$height) = getimagesize($source_pic); 

     $x_ratio = $max_width/$width; 
     $y_ratio = $max_height/$height; 

     if(($width <= $max_width) && ($height <= $max_height)){ 
     $tn_width = $width; 
     $tn_height = $height; 
     } 
     elseif($y_ratio == 0){ 
     $tn_height = ceil($x_ratio * $height); 
     $tn_width = $max_width; 
     } 
     elseif($x_ratio == 0){ 
     $tn_width = ceil($y_ratio * $width); 
     $tn_height = $max_height; 
     } 
     elseif (($x_ratio * $height) < $max_height){ 
     $tn_height = ceil($x_ratio * $height); 
     $tn_width = $max_width; 
     } 
     else{ 
     $tn_width = ceil($y_ratio * $width); 
     $tn_height = $max_height; 
     } 

    // $ext = strtolower(array_pop(explode(".", $srcimg))); 
     $ext=substr($srcimg,-3,3); 
     //ini_set('memory_limit', '32M'); 

     $tmp=imagecreatetruecolor($tn_width,$tn_height); 
     //print_r($tmp.$src);die; 

     imagecopyresampled($tmp,$src,0,0,0,0,$tn_width, $tn_height,$width,$height); 

     if(($ext=="jpg") || ($ext=="jpeg")) 
     { 
     $ye = imagejpeg($tmp, $save, 100) ; 
     } 

     if($ext=="gif"){ imagegif($tmp, $save) ; } 
     if($ext=="bmp"){ imagebmp($tmp, $save) ; } 
     if($ext=="png"){ 
     //imagecolortransparent($tmp, imagecolorallocate($tmp,0,0,0)); 
     imagepng($tmp, $save, 9) ; 
     } 

} 
$this->resize_img($siurcename,$dest_img2,83,83);//calling function 
相關問題