Home N-13 News Forums Help Search
RegisterForgot password?
How to add image to post necklacesdiscou
Known bugs - 4.0.3 necklacesdiscou

Latest N-13 News 4.0.3

What is N-13 News?
Where can I get help?
Known bugs

Forums Help & Support getimagesize problem
Packyak
Posted on 26 Oct 2009, 18:58:33

Access: Member
Total Posts: 5
Joined: 2009-10-21

Hi

i keep getting the following issue when trying to add a image (via link) to a news post.

Warning: getimagesize(\"http://www.packyak.net/images/pumpkin.gif\) [function.getimagesize]: failed to open stream: Invalid argument in D:\home\Default\packyak.net\htdocs\news\bbparser.php on line 6

Thanks
#1135
Packyak
Posted on 26 Oct 2009, 18:59:54

Access: Member
Total Posts: 5
Joined: 2009-10-21

this is the code from the file;

Code:
<?php
function resizeimg($str,$caption,$oldformat){
    global 
$image_maxheight, $image_maxwidth, $adminpath;
    
$str = str_replace(" ", "%20",$str);
    
$caption = stripslashes($caption);
    list(
$width, $height, $type, $attr) = getimagesize("$str");
    if(!
$image_maxheight){ $image_maxheight = $height; }
    if(!
$image_maxwidth){ $image_maxwidth = $width; }
    if(
$width > $image_maxwidth || $height > $image_maxheight){         
        if(
$width > $image_maxwidth || $height > $image_maxheight){
            
$new_width = $width;
            
$new_height = $height;
            
$percent = 0.9;                    
            while(
$new_width > $image_maxwidth|| $new_height > $image_maxheight){
                
$new_width = $width * $percent;
                
$new_height = $height * $percent;
                
$percent = $percent - 0.01;
            }
        }else{
            
$new_width = $width;
            
$new_height = $height;            
        }         
        return 
"<div class=\"image_container\" style=\"width: $new_width" . "px\"><a href=\"$str\"><img class=\"fullnewsimage\" alt=\"image\" src=\"" . $adminpath . "?action=options&mod=imageuploads&width=$new_width&height=$new_height&thumb=$str\" /></a><br style=\"clear: both\" /><span class=\"image_caption\">$caption</span></div>";
    }else{
        return 
"<div class=\"image_container\" style=\"width: $width" . "px\"><img src=\"$str\" class=\"fullnewsimage\" width=\"$width\" alt=\"image\" height=\"$height\" /><br /><span class=\"image_caption\">$caption</span></div>";
    }
}

#on-the-fly links
function linkfy($str){
    
$d = explode("\n",$str);
    foreach(
$d as $url){
        if(
$url !== ""){
            
$url = str_replace("<br />","",$url);
            
$newstr .= "<a href=\"$url\">$url</a><br />\n";    
        }
    }
    return 
$newstr;
}

function 
bb2html($str,$usehtml) {
    global 
$langmsg, $newssmilies;
    
$bb2html = $str;                                  
    if(
$usehtml == "0"){
        
$bb2html = htmlentities($bb2html, ENT_NOQUOTES, 'utf-8');
    }

    
$sqlbb = "SELECT keycode,path FROM $newssmilies";
    
$querybb = mysql_query($sqlbb) or die(mysql_error());
    while(
$rowbb = mysql_fetch_array($querybb)){
        
$bb2html = str_replace($rowbb['keycode'],"<img src=\"$rowbb[path]\" alt=\"".$rowbb['keycode']."\" />",$bb2html);
    }
    
$bb2html = str_replace("\r",'<br />', $bb2html); 
    
$bb2html = preg_replace("#\[url\](.*?)\[\/url\]#se", "'' . linkfy(\"$1\") . ''", $bb2html);
    
$bb2html = str_replace('[left]', '<div align="left">', $bb2html);
    
$bb2html = str_replace('[/left]', '</div>', $bb2html);
    
$bb2html = str_replace('[center]', '<div align="center">', $bb2html);
    
$bb2html = str_replace('[/center]', '</div>', $bb2html);
    
$bb2html = str_replace('[right]', '<div align="right">', $bb2html);
    
$bb2html = str_replace('[/right]', '</div>', $bb2html);
    
$bb2html = str_replace('[b]', '<strong>', $bb2html);
    
$bb2html = str_replace('[/b]', '</strong>', $bb2html);
    
$bb2html = str_replace('[i]', '<em>', $bb2html);
    
$bb2html = str_replace('[/i]', '</em>', $bb2html);
    
$bb2html = str_replace('[u]', '<u>', $bb2html);
    
$bb2html = str_replace('[/u]', '</u>', $bb2html);
    
$bb2html = str_replace('[*]', '<li>', $bb2html);
    
$bb2html = str_replace('[/*]', '</li>', $bb2html);
    
$bb2html = str_replace('[ul]', '<ul>', $bb2html);
    
$bb2html = str_replace('[/ul]', '</ul>', $bb2html);
    
$bb2html = str_replace('[list]', '<ul>', $bb2html);
    
$bb2html = str_replace('[/list]', '</ul>', $bb2html);
    
$bb2html = str_replace('[ol]', '<ol>', $bb2html);
    
$bb2html = str_replace('[/ol]', '</ol>', $bb2html);
    
$bb2html = str_replace('</li><br />', '</li>', $bb2html);
    
$bb2html = str_replace('<ul><br />', '<ul>', $bb2html);
    
$bb2html = str_replace('</ul><br />', '</ul>', $bb2html);
    
$bb2html = str_replace('<ol><br />', '<ol>', $bb2html);
    
$bb2html = str_replace('</ol><br />', '</ol>', $bb2html);
    
$bb2html = str_replace('[/img]<br />', '[/img]', $bb2html);
    
$bb2html = str_replace('[quote]', "<div class=\"quote\">", $bb2html);
    
$bb2html = str_replace('[/quote]', '</div>', $bb2html);
    
$bb2html = preg_replace("/\[size=(\W?)(.*?)(\W?)\](.*?)\[\/size\]/", '<font style="font-size: $2">$4</font>', $bb2html);
    
$bb2html = preg_replace("/\[email\=(.+?)\](.+?)\[\/email\]/i", '<a href="mailto:$1">$2</a>', $bb2html);
    
$bb2html = preg_replace("/\[url=(\W?)(.*?)(\W?)\](.*?)\[\/url\]/", '<a href="$2">$4</a>', $bb2html);
    
$match = array('#\[img=(\W?)(.*?)(\W?)\](.*?)\[\/img\]#se');
    
$replace = array("'' . resizeimg('$2','$4','') . ''");
    
$bb2html = preg_replace($match, $replace, $bb2html);    
    
##oldformat [img]http://[/img]
    
$match = array('#\[img\]http://(.*?)\[\/img\]#se');
    
$replace = array("'' . resizeimg('http://$1','','true') . ''");
    
$bb2html = preg_replace($match, $replace, $bb2html);    
    
$bb2html = preg_replace('/\[color\=(.+?)\](.+?)\[\/color\]/is', "<span style=\"color:$1\">$2<!--color--></span>", $bb2html);
    
    return 
$bb2html;
}
?>
#1136
Ronald
Posted on 28 Oct 2009, 20:47:20

Access: Member
Total Posts: 45
Joined: 2009-09-11

Read this;
Post
#1137
Last edited by Ronald at 2009-10-28 20:47:59 Reason:
Network-13.com © 2013