This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dirname = "img/"; // répertoire | |
$images = glob($dirname."*.jpg"); | |
foreach($images as $image) { | |
echo '<img src="'.$image.'" class="img-fluid" />'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$fp = fopen("$url","rb"); | |
if($pointer = fopen("$namef","wb+")) // nom du fichier a créer | |
{ | |
while($buffer = fread($fp, 1024)) | |
{ | |
if(!fwrite($pointer,$buffer)) | |
{ | |
return FALSE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*---------------------------------------------------------------*/ | |
/* Redimensionner une image sans distorsion fct_affich_image | |
/*---------------------------------------------------------------*/ | |
function fct_affich_image($Wmax, $Hmax, $img_Src) { | |
// Lit les dimensions de l'image | |
$sizeimg = GetImageSize($img_Src); | |
$Src_W = $sizeimg[0]; // largeur | |
$Src_H = $sizeimg[1]; // hauteur |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*--------------------------------------------------------------------*/ | |
/* Redimensionner une image sans distorsion function Resize_picture */ | |
/*--------------------------------------------------------------------*/ | |
function Resize_picture($fichier,$maxWidth,$maxHeight) | |
{ | |
# Passage des paramètres dans la table : imageinfo | |
$imageinfo= getimagesize("$fichier"); | |
$iw=$imageinfo[0]; | |
$ih=$imageinfo[1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="demo"><div class="row mb-5"> | |
<?php | |
/*---------------------------------------------------------------*/ | |
/*'@' est placé devant la fonction getImageSize()pour empêcher l'affichagedes erreurs si l'image est absente.*/ | |
/*---------------------------------------------------------------*/ | |
$chemin = 'img/getimagesize.jpg'; // chemin de l'image | |
$infos_image = @getImageSize($chemin); // info sur la dimension de l'image | |
//dimension |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Options +FollowSymlinks | |
RewriteEngine on | |
RewriteCond %{HTTP_HOST} ^www.votre-site.eu$ | |
RewriteRule ^(.*) http://votre-site.eu/$1 [QSA,L,R=301] | |
RewriteEngine On | |
RewriteRule ^([a-zA-Z0-9\-\_]+)$ $1.php | |
RewriteEngine On | |
RewriteCond %{SERVER_PORT} 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function indexed($url) { | |
$url = 'http://webcache.googleusercontent.com/search?q=cache:' . urlencode($url); | |
$ch = curl_init($url); | |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); | |
curl_setopt($ch, CURLOPT_NOBODY, true); | |
curl_setopt($ch, CURLOPT_USERAGENT, 'Chrome 10'); | |
if (!curl_exec($ch)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Message d'erreur à sauvegardez | |
$errorMessage = "Message erreur à sauvegardez!"; | |
// Chemin et nom du fichier log où les erreurs seront sauvegardées | |
$logFile = "errors.log"; | |
error_log($errorMessage, 3, $logFile); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = 'https://le-site.com/le-nom-de-l-images.png'; | |
$img = 'images/logo125.png'; | |
// Enregistrer l'image | |
file_put_contents($img, file_get_contents($url)); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// URL du fichier distant | |
$rFile = 'https://site-web.com/robots.txt'; | |
// Ouvrir le fichier | |
$check = @fopen($rFile, 'r'); | |
// Vérifier si le fichier existe | |
if(!$check){ | |
echo 'Fichier non trouvé'; | |
}else{ | |
echo 'Fichier trouvé'; |