hallo allemaal,

ik heb een veiling/advertentie site waarop ik advertenties van verscheidene kinder en baby spullen aanbied. Hierin zijn .jpg afbeeldingen verwerkt waarbij er enkele zichtbaar zijn maar enkele ook niet. Ik wijdt het aan de spaties die in de URL link staan die verwijzen naar de afbeeldingen. Ik heb alles al geprobeerd met html entities en str_replace maar tot op heden geen resultaat. Wie kan me op weg helpen.

Ik heb het script welke ik gebruik bijgevoegd. Alvast bedankt!

Link naar voorbeeld: http://www.deveilingspeelplaats.nl/adsearch.php?PAGE=5

<?php

$w = $_GET['w'];
$fromfile = $_GET['fromfile'];
$nomanage = false;

function ErrorPNG($err)
{
header('Content-type: image/png');
$im = imagecreate(100, 30);
$bgc = imagecolorallocate($im, 255, 255, 255);
$tc = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 100, 30, $bgc);
imagestring($im, 1, 5, 5, $err, $tc);
imagepng($im);
}

// control parameters and file existence
if (!isset($_GET['fromfile']))
{
ErrorPNG('params empty');
exit;
}
elseif (!file_exists($_GET['fromfile']) && !fopen($_GET['fromfile'], 'r'))
{
ErrorPNG('img does not exist');
exit;
}

if (file_exists('uploaded/cache/' . $_GET['w'] . '-' . md5($fromfile)))
{
$img = getimagesize($fromfile);
echo file_get_contents('uploaded/cache/' . $_GET['w'] . '-' . md5($fromfile));
}
else
{
if (function_exists('imagetypes'))
{
if (!is_dir('uploaded/cache')) mkdir('uploaded/cache', 0777);

if (!isset($_GET['w'])) $w = 100;
$img = @getimagesize($fromfile);
if (is_array($img))
{
switch ($img[2])
{
case 1 :
if (!(imagetypes() &IMG_GIF))
{
if (!function_exists('imagecreatefromgif'))
{
$nomanage = true;
}
else
{
$outype = 'png';
$img['mime'] = 'image/png';
}
}
else
{
$outype = 'gif';
}
$imtype = 'gif';
break;
case 2 :
if (!(imagetypes() &IMG_JPG)) $nomanage = true;
$outype = 'jpeg';
$imtype = 'jpeg';
break;
case 3 :
if (!(imagetypes() &IMG_PNG)) $nomanage = true;
$imtype = 'png';
$outype = 'png';
break;
default :
ErrorPNG('wrong img type');
exit;
}
// check image orientation
if ($img[0] < $img[1])
{
$h = $w;
$ratio = floatval($img[1] / $h);
$w = ceil($img[0] / $ratio);
}
else
{
$ratio = floatval($img[0] / $w);
$h = ceil($img[1] / $ratio);
}
}
else
{
ErrorPNG('not image type');
exit;
}
}
else
{
$nomanage = true;
}
if ($nomanage)
{
ErrorPNG('image type not supported');
exit;
}

$ou = imagecreatetruecolor($w, $h);
imagealphablending($ou, false);
$funcall = "imagecreatefrom$imtype";
imagecopyresampled($ou, $funcall($fromfile), 0, 0, 0, 0, $w, $h, $img[0], $img[1]);
$funcall = "image$outype";
$funcall($ou, 'uploaded/cache/' . $_GET['w'] . '-' . md5($fromfile));
}

header('Content-type: ' . $img['mime']);
$funcall($ou);
?>

// image icon
if (!empty($row['pict_url']))
{
if (($row['auction_type']) == 3)
{
$row['pict_url'] = 'getthumb.php?w=' . $system->SETTINGS['thumb_show'] . '&fromfile=' . $row['pict_url'];
}
else
{
$row['pict_url'] = $system->SETTINGS['siteurl'] . 'getthumb.php?w=' . $system->SETTINGS['thumb_list'] . '&fromfile=' . $uploaded_path . $row['id'] . '/' . $row['pict_url'];
}

[size=xsmall]Toevoeging op 09/10/2011 20:28:18:[/size]

Voorbeelden van url zoals in de database opgenomen:
FOUT: http://www.buikbanden.com/images/options/20116/Mamaband I love Papa.jpg
GOED: http://www.buikbanden.com/images/options/20116/Mamaband-zwart.jpg
Haal gewoon die spaties uit de namen van de plaatjes. Die horen daar ook niet.
Zelfde probleem gehad, zat hem toen in:
fout: <a href=image naam.jpg>
goed: <a href="image name.jpg">

Oftewel: zorg ervoor dat bij eventuele links etc alles tussen "" staat
en gebruik eventueel urlencode()

Reageren