Pages vues depuis 25/05/2001 : 110 428 686
Index du forum »» Le coin des codeurs »» [Résolu] - image
<?
$origin_filename = trim($upload->getFileName("newcard".$i));
$ext = strtolower(substr(strrchr($origin_filename, "."),1));
$num = mysql_fetch_row(mysql_query("SELECT LAST_INSERT_ID()"));
$field1_filename = $num[0].".".$ext;
$FileTemp = $upload->getTempFile("newcard".$i);
list($TempWidth, $TempHeight, $MimeType, $attr) = getimagesize("$FileTemp");
if ($MimeType == "1" || $MimeType == "2" || $MimeType == "3" || $MimeType == "6") {
............................
?>
Citation : oim
Il ne marche pas ce code.
$image2 = preg_replace("/b([^s]+)s*=s*("|')([s]*?)("|')s/", "", " $image ");
OpenTable();
echo "<TABLE WIDTH=100% CELLSPACING=2 CELLPADDING=2 BORDER=0><TR><TD CLASS=\"HEADER\">\n";
$result=mysql_query("select content from seccont where secid='10' ");
list($content) = mysql_fetch_row($result);
echo "<tr><TD CLASS=\"HEADER\">$content</td></tr>";
echo "</TD></TR></TABLE>\n";
CloseTable();
function img_extractor_string($chaine){
$retour = array();
while($x = stristr($chaine, "<img")){
$image = substr($x, 4, strpos($x, ">")-4);
#print "n";
$chaine = substr($x, strpos($x, ">"));
preg_match_all("/b([^s]+)s*=s*("|')(.*?)("|')s/", " $image ",
$attribut);
$details = arrays2hash($attribut[1], $attribut[3]);
$details['tag'] = $image;
$image2 = preg_replace("/b([^s]+)s*=s*("|')([s]*?)("|')s/", "",
" $image ");
preg_match_all("/b([^s]+)s*=s*([^s]*?)s/", " $image2 ",
$attribut);
// l'ordre du merge est important : on ecrase les valeurs
trouvees sans guillemets
// par celle trouvee avec.
$details = array_merge( arrays2hash($attribut[1], $attribut[2]),
$details);
array_push($retour, $details);
}
return $retour;
}
$imgs = img_extractor_string($content);
print_r($imgs);
<?PHP
if(!isset($mainfile)) { !include!("mainfile.php"); }
global $pdst; $pdst="1";
!include!("header.php");
function img_extractor_string($chaine){
$retour = array();
while($x = stristr($chaine, "<img")){
$image = substr($x, 4, strpos($x, ">")-4);
#print "n";
$chaine = substr($x, strpos($x, ">"));
preg_match_all("/b([^s]+)s*=s*("|')(.*?)("|')s/", " $image ", $attribut);
$details = arrays2hash($attribut[1], $attribut[3]);
$details['tag'] = $image;
$image2 = preg_replace("/b([^s]+)s*=s*("|')([s]*?)("|')s/", "", " $image ");
preg_match_all("/b([^s]+)s*=s*([^s]*?)s/", " $image2 ", $attribut);
// l'ordre du merge est important : on ecrase les valeurs
trouvees sans guillemets
// par celle trouvee avec.
$details = array_merge( arrays2hash($attribut[1], $attribut[2]), $details);
array_push($retour, $details);
}
return $retour;
}
OpenTable();
echo "<TABLE WIDTH=100% CELLSPACING=2 CELLPADDING=2 BORDER=0><TR><TD CLASS=\"HEADER\">\n";
$result=mysql_query("select content from seccont where secid='10' ");
list($content) = mysql_fetch_row($result);
$imgs = img_extractor_string($content)
echo "<tr><TD CLASS=\"HEADER\">print_r($imgs);</td></tr>";
echo "</TD></TR></TABLE>\n";
CloseTable();
!include!("footer.php");
?>
preg_match_all("/b([^s]+)s*=s*("|')(.*?)("|')s/", " $image ", $attribut);
function ephemblock() {
global $gmt;
$eday=date("d",time()+($gmt*3600));
$emonth =date("m",time()+($gmt*3600));
$result = mysql_query("select yid, content from ephem where did='$eday' AND mid='$emonth' order by yid ASC");
while (list($yid, $content) = mysql_fetch_array($result)) {
if ($cnt==1)
$boxstuff .= "<br /><br />";
$boxstuff .= aff_langue($content);
$cnt = 1;
}