Posts Tagged ‘ images ’
Cách 1: Xài file htaccess: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_REFERER} !^http://([^.]+\.)?domain\.com/ [NC] RewriteCond %{HTTP_USER_AGENT} !(googlebot-image|msnbot|psbot|yahoo-mmcrawler) [NC] RewriteRule \.(bmp|gif|jpe?g|png)$ - [NC,F] </IfModule> Với cách này thì khi site nào chôm link ảnh sẽ không thấy được ảnh Cách 2: Cũng xài htaccess: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_REFERER} !^http://([^.]+\.)?domain\.com/ [NC] RewriteCond %{HTTP_USER_AGENT} !(googlebot-image|msnbot|psbot|yahoo-mmcrawler) [NC] RewriteCond %{REQUEST_URI} !^/hotlink\.png$ RewriteRule \.(bmp|gif|jpe?g|png)$ /hotlink.png [L] </IfModule> Với cách này thì site nào chôm link ảnh sẽ [ READ MORE ]
<? $filename = "image.jpg"; $image = file_get_contents($filename); $image = imagecreatefromstring($image); $width = imagesx($image); $height = imagesy($image); $m_aspect = 164.0 / 48.0; $i_aspect = $width / $height; if($i_aspect < $m_aspect) { $percent = 48.0 / $height; $new_height = $height * $percent; $new_width = 11.875 * $new_height / 6.0 * $width / $height; } else { $percent = 164.0 / $width; $new_width = $width * $percent; $new_height = 6.0 * $new_width / 11.875 * $height [ READ MORE ]
function listImages($dirname=".") { $ext = array("jpg", "png", "jpeg", "gif"); $files = array(); if($handle = opendir($dirname)) { while(false !== ($file = readdir($handle))) for($i=0;$i<sizeof($ext);$i++) if(strstr($file, ".".$ext[$i])) $files[] = $file; closedir($handle); } return($files); } loadt2player(116)[ READ MORE ]
Bad Behavior has blocked 29 access attempts in the last 7 days.