• I recently hired a programmer to write some custom code for me so that my WP has a Image and Category search and search results pages. After some back and forth and issues he finally got it working….. for about a day. Now when I enter a keyword or use the category pull down it just hangs and hangs….. and finally where the thumbnails on the results page should show up I get an error message that says…..

    Warning: getimagesize(https://www.zenstream.net/zenphotos/thumbs/bal1-050.jpg) [function.getimagesize]: failed to open stream: No route to host in /hermes/bosweb/web212/b2124/nf.zenstreaminfo

    …..so I checked the [function.getimagesize] to see if there was some clues to the problem but I am useless at php thats why I hired the programmer.

    this is the function.getimagesize code fro the functions.php page

    function getImage($num) {
    	global $more;
    	$more = 1;
    	$link = get_permalink();
    	$content = get_the_content();
    	$count = substr_count($content, '<img');
    	$start = 0;
    	for($i=1;$i<=$count;$i++) {
    		$imgBeg = strpos($content, '<img', $start);
    		$post = substr($content, $imgBeg);
    		$imgEnd = strpos($post, '>');
    		$postOutput = substr($post, 0, $imgEnd+1);
    		//$postOutput = preg_replace('/width="([0-9]*)" height="([0-9]*)"/', '',$postOutput);
    		$postOutput = preg_replace('/alt="/', '/width="180" class="attachment-180x180" alt="',$postOutput);
    		$image[$i] = $postOutput;
    		$start=$imgEnd+1;
    	}
    	if(stristr($image[$num],'<img')) { echo '<a href="'.$link.'">'.$image[$num]."</a>"; }
    	$more = 0;
    }
    
    function getThumb($num) {
    	global $more;
    	$more = 1;
    	$imgwidth = "";
    	$imgclass = "";
    	$link = get_permalink();
    	$content = get_the_content();
    	$count = substr_count($content, '<img');
    	$start = 0;
    	for($i=1;$i<=$count;$i++) {
    		$imgBeg = strpos($content, '<img', $start);
    		$post = substr($content, $imgBeg);
    		$imgEnd = strpos($post, '>');
    		$postOutput = substr($post, 0, $imgEnd+1);
    		$srcBeg = strpos($postOutput, 'src=');
    		$source = substr($postOutput, $srcBeg+5);
    		$srcEnd = strpos($source, '"');
    		$sourceOutput = substr($source, 0, $srcEnd);
    		$sourceOutput = preg_replace('/lowresWM/', 'thumbs', $sourceOutput);
    		$image[$i] = $sourceOutput;
    		$start=$imgEnd+1;
    	}

    ..any suggestions would be seriously appreciated. or at least some direction on how to narrow down the problem.

    The URL is:
    https://www.zenstream.net/zen/
    if anyone wants to test use the keyword “bali” or the category pull down “bali”. the others just come up as no search results.

    Thank You.

  • The topic ‘Custom Image Search/Search Results hangs’ is closed to new replies.