wmguk Posted January 30, 2008 Share Posted January 30, 2008 hey guys, I am using a thumbnail script and it gets the images from a directory, the images are found in ../../clients/$dir but i dont want to show the directory structure, in the images name so how can i specify the directory with out making the structure part of the name? $dir = $_GET['login']; $pricing = $_GET['pricing']; $NBFile=0; $dir ="../../clients/$dir"; if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { //if (substr($file, strlen($file)-3, 3)=="jpg" ) { $FileArray[] = $dir."/".$file; $NBFile=$NBFile+1; //} } } } closedir($handle); any ideas? Cheers Drew Link to comment https://forums.phpfreaks.com/topic/88547-help-with-directory-included-in-string/ Share on other sites More sharing options...
trq Posted January 30, 2008 Share Posted January 30, 2008 $FileArray[] = $file; Link to comment https://forums.phpfreaks.com/topic/88547-help-with-directory-included-in-string/#findComment-453283 Share on other sites More sharing options...
wmguk Posted January 30, 2008 Author Share Posted January 30, 2008 $FileArray[] = $file; Thank you, when i try this none of the images display, as this script is in a subfolder a few levels away, i just get box with red X but it does remove the directory information..... nearly Link to comment https://forums.phpfreaks.com/topic/88547-help-with-directory-included-in-string/#findComment-453285 Share on other sites More sharing options...
trq Posted January 30, 2008 Share Posted January 30, 2008 If you want the images to display you need to use the path. Link to comment https://forums.phpfreaks.com/topic/88547-help-with-directory-included-in-string/#findComment-453286 Share on other sites More sharing options...
wmguk Posted January 30, 2008 Author Share Posted January 30, 2008 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <?php $dir = $_GET['login']; $pricing = $_GET['pricing']; $NBFile=0; $dir ="../../clients/$dir"; if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { //if (substr($file, strlen($file)-3, 3)=="jpg" ) { $FileArray[] = $dir."/".$file; $NBFile=$NBFile+1; //} } } } closedir($handle); ?><html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } .image{ border-style:outset; border-color: black; border-width:1px; } </style> </head> <body><table align="center"><tr> <?php $NBPicswidth=1; $NBPics=0; for ($i=0; $i<$NBFile; $i++) { $Pic_Name1=$FileArray[$i]; ?><td class="image"> <a href="dis.php?image=<?php echo $Pic_Name1; ?>&pricing=<?php echo $pricing; ?>" target="order"><img src="<?php echo $Pic_Name1; ?>" width="100" border="0" align="top"></a> </td></tr><?php $NBPics=$NBPics+1; if ( $NBPics==$NBPicswidth ) { $NBPics=0; ?> <?php } } ?></table> </body> </html> is there anyway to just see the image name in this script? Link to comment https://forums.phpfreaks.com/topic/88547-help-with-directory-included-in-string/#findComment-453338 Share on other sites More sharing options...
trq Posted January 30, 2008 Share Posted January 30, 2008 I just showed you. Link to comment https://forums.phpfreaks.com/topic/88547-help-with-directory-included-in-string/#findComment-453343 Share on other sites More sharing options...
wmguk Posted January 30, 2008 Author Share Posted January 30, 2008 ok, i need to show the image and have the image name with no directory information, sorry if i seem stupid but how do i do that? Link to comment https://forums.phpfreaks.com/topic/88547-help-with-directory-included-in-string/#findComment-453349 Share on other sites More sharing options...
wmguk Posted March 10, 2008 Author Share Posted March 10, 2008 I want to assign a new variable ie $imagename to this, so I can see the image but also have the name without the path, <?php $dir = $_GET['login']; $pricing = $_GET['pricing']; $NBFile=0; $dir ="../../clients/$dir"; if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { //if (substr($file, strlen($file)-3, 3)=="jpg" ) { $FileArray[] = $dir."/".$file; $NBFile=$NBFile+1; //} } } } closedir($handle); ?> I dont seem to be able to add a second array just displaying the $file information Link to comment https://forums.phpfreaks.com/topic/88547-help-with-directory-included-in-string/#findComment-488667 Share on other sites More sharing options...
wmguk Posted March 10, 2008 Author Share Posted March 10, 2008 SOLVED.... sorry to bring up an old thread, just added a new array. Link to comment https://forums.phpfreaks.com/topic/88547-help-with-directory-included-in-string/#findComment-488680 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.