zdravím. chtěl bych použít tenhle plugin do wordpressu, abych nemusel ručně linkovat obrázky, ale na mojem hostingu to nefunguje.
hosting je na pipni.cz . upload je na http://myistri.net/uploads/Image . hostname je http://myistri.net .
zkoušel jsem to na phphome s register_globals = OFF a funguje mi to dobře, takže globálníma proměnnýma to nebude. přístupové práva jsou pro všechny složky na 777.
v php jsem celkem lama, tak nevím, kde by mohla být chyba.
Kód:function autogallery($text) { global $id; // Settings start $usehostname = "yes"; // If You want to use the hostname in image-URLs set to yes. $image_root = "/uploads/Image/"; // Set this to Your image-root. $thumbnail_prefix = "^(150|thumbs|thumb)\-"; // Your thumbnail-prefixes as "regexp" $allowed_files = "(jpg|png|gif)"; // Allowed files as "regexp". // Settings end if ($usehostname == "yes") { $usehost = "http://".$_SERVER["HTTP_HOST"]; } $filedir = $image_root.$id."/"; $searchdir = $_SERVER["DOCUMENT_ROOT"].$filedir; if (is_readable($searchdir)) { if ($handle = opendir($searchdir)) { while (false !== ($file = readdir($handle))) { if (eregi($allowed_files, $file) && eregi($thumbnail_prefix, $file) && !eregi($file, $text)) { $imagename = $searchdir."".$file; if (is_readable($imagename)) { $countup++; clearstatcache(); $size = @getimagesize($searchdir.$file); $thumbnail = $usehost . $filedir . eregi_replace($thumbnail_prefix, "", $file); $gallery_image = $usehost . $filedir . $file; $alt_title = eregi_replace($thumbnail_prefix, "", $file); $alt_title = eregi_replace($allowed_files, " ", $alt_title); $alt_title = eregi_replace("([^a-zA-Z0-9_\-])", "", $alt_title); $alt_title = eregi_replace("_|\-", " ", $alt_title); $gallery .= "<a href=\"".$thumbnail."\" target=_blank><img class=\"center\" src=\"".$gallery_image."\" alt=\"".ucwords($alt_title)."\" title=\"".ucwords($alt_title)."\" ".$size[3]." /></a> "; } } } closedir($handle); } } if (eregi("<!--gallery-->", $text)) { if ($countup == 0) { $gallery = eregi_replace("<!--gallery-->", "", $text); } else { $gallery = eregi_replace("<!--gallery-->", $gallery, $text); } } else { $gallery = $text; } return $gallery; } add_filter('the_content', 'autogallery', 4);






Odpověď s citací