Jump to content

Dogrox

Members
  • Posts

    23
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Dogrox's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Man I forgot about this post!.. here is my followup. Anyways, for me to fix my problem I wrote my own code from scratch and it calls up fine from the folder i wanted it to in the first place. I dont knwo what the heck why it was doing witht hat other code. but it works better now since wrote my own from scratch.. Hey thats the learning process ) I will mark this solved!
  2. sorry i posted my rerply in the wrong post!. sorry about that!
  3. that all depends on where your trying to call it up from. if the file that has the include statment in it.. is in another SUB folder.,, and the include folder is off root. Like .. www/includes/include.php which is saying ti is form the root. but the file that you are trying to licude that is in say www/subfolder/filename.ext so you need to go back to root then to includes folder.. then both dots would work! butwhat if the includes folder is in www/subfolder/include/include.php where the file that is calling it up is in the root of that sub folder too then you would use one dot.. that will bring it only back to the subfolder thats what i have been experieinceing.
  4. doode just use one dot './include/include.php' that should work from the folder your already in. I Know I am having similar peroblems
  5. Medhi, Your code quote isnt doing what i need, in fact it is doing the oposite. It is defeating the pupose of what I need to do. I will to try to explain this again. I need the code to read a WHOLE directory of image files, and then make thumnails in a an html table that specifys number of columns. Like I have been saying, the code I pasted WORKS when it is called up from the specific image folder as a STAND ALONE php file. It generates the thumbnails etc etc. SO I know it is working code. But the problem is when I call the code up from a template file from another location on the site it does nothing except prints the text PHOTO GALLERY then stops. Thats where my problem is trying to get the code to work when it is called from another location. I even bypassed the template files and tried to call the code up from the MAIN ROOT still as STAND ALONE file, and adding the $photodir arable changes as mentioned above. And it still doesnt work.. just printsd the text PHOTO GALLERY as if it os trying to run, but doesnt. So it isnt the template giving it a problem. It is a problem with the code being called from another location! This is totally buggin me i been on this thing all night trying every which way i can think of!
  6. I think you mistunderstanding the problem. In the code that i pasted. It does generate the thumbnails and it works fine when i call the php file from image folder itself. The thumbs are displayed and everything works fine. So i know the code works... But when i call the code up from a different location like a link on the main page thats in a different location on site, the code starts .. prints the text photogallery" and then halts! its a problem with the actual location of the code from the main site itself that i cant seem to get worked out.
  7. man this is really frustrating.. i tried every combinatin possible to try to get this to work.. and it doesnt show anything. II wanna call it from a TPL file.... i put the thumbnail code in one of the image folders: 'mainimages/gallery2007/' I called the file 'thumbs.php' Then in my template folder for the file that loads up . I have it include the thumbs.php from that gallery folder. The file IS INdeed loaded.. cause the title/text "photo gallery" shows up on top.. as the page is tryign to generate.. but nothign else.. i added a DIE in ther to see where ti is killed and it seems like the folder isnt found even though the php file is RIGHT in that image folder. and that is FOUND! This is really starting to bug the crap out of me! Thanks in advance for your help!! Sincerely Dog
  8. ok leaving the code stock so it works when loading it from each individual image folder. As it works that way, so i am trying another way to go about this. When you load the main index there is a simple link to that php code in them folders.. and it STILl shows up nothing on the page.
  9. Same thing, nothing appears on the page except the text "photogallery"
  10. Thank you to F1FAN for helping me with that ARRAY problem before. Now i have another NEW problem I have this script i was learning from an on line php tutorial. The code works fine if the code is in the SAME folder as the images. But I want to call this script from the main folder where the main index.php is. The images to make the thumnnails are in seperate sub folders like "/mainimages/gallery2008/" "/mainimages/gallery2007/" etc etc I noticed that the code checks for $handle=opendir(".") Thats why it works when the code is in EACH of the seperate image folders. So i move the code to the main index folder and then i added this: $photodir = './mainimages/gallery2007/'; and those two lines in the main code , that have that opendir(".") to opendir($photodir) And then the page displays nothing. except the text "photo gallery" on top No error at all. here is the code <?php $columns = 5; $thmb_width = 120; $thmb_height = 80; function resizeImage($originalImage,$toWidth,$toHeight){ // Get the original geometry and calculate scales list($width, $height) = getimagesize($originalImage); $xscale=$width/$toWidth; $yscale=$height/$toHeight; // Recalculate new size with default ratio if ($yscale>$xscale){ $new_width = round($width * (1/$yscale)); $new_height = round($height * (1/$yscale)); } else { $new_width = round($width * (1/$xscale)); $new_height = round($height * (1/$xscale)); } // Resize the original image $imageResized = imagecreatetruecolor($new_width, $new_height); $imageTmp = imagecreatefromjpeg ($originalImage); imagecopyresampled($imageResized, $imageTmp, 0, 0, 0, 0, $new_width, $new_height, $width, $height); return $imageResized; } function generateThumbnails(){ global $thmb_width,$thmb_height; // Open the actual directory if ($handle = opendir(".")) { // Read all file from the actual directory while ($file = readdir($handle)) { // Check whether tha actual item is a valid file if (is_file($file)){ // Check whether the actual image is a thumbnail if (strpos($file,'_th.jpg')){ $isThumb = true; } else { $isThumb = false; } if (!$isThumb) { // Process the file string $dirName = substr($file,0,strpos($file,basename($file))); if (strlen($dirName) < 1) $dirName = '.'; $fileName = basename($file); $fileMain = substr($fileName,0,strrpos($fileName,'.')); $extName = substr($fileName,strrpos($fileName,'.'), strlen($fileName)-strrpos($fileName,'.')); // Check if the actual file is a jpeg image if (($extName == '.jpg') || ($extName == '.jpeg')){ $thmbFile = $dirName.'/'.$fileMain.'_th.jpg'; // If a thumbnail dosn't exists tahn create a new one if (!file_exists($thmbFile)){ imagejpeg(resizeImage($file,$thmb_width,$thmb_height) ,$thmbFile,80); } } } } } } } function getNormalImage($file){ $base = substr($file,0,strrpos($file,'_th.jpg')); if (file_exists($base.'.jpg')) return $base.'.jpg'; elseif (file_exists($base.'.jpeg')) return $base.'.jpeg'; else return ""; } function displayPhotos(){ global $columns; generateThumbnails(); $act = 0; // Open the actual directory if ($handle = opendir(".")) { // Read all file from the actual directory while ($file = readdir($handle)) { // Check whether tha actual item is a valid file if (is_file($file)){ // Check whether the actual image is a thumbnail if (strpos($file,'_th.jpg')){ ++$act; if ($act > $columns) { echo '</tr><tr> <td class="photo"><a href="'.getNormalImage($file).'"> <img src="'.$file.'" alt="'.$file.'"/></a></td>'; $act = 1; } else { echo '<td class="photo"><a href="'.getNormalImage($file).'"> <img src="'.$file.'" alt="'.$file.'"/></a></td>'; } } } } } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> <head> <title>Photo Gallery</title> </head> <body> <center><h3>Photo Gallery</h3></center> <table align="center"><tr> <?php displayPhotos(); ?> </table> </body>
  11. Yep I just marked it SOLVED.. it was on the left side on my end!.. on the bottom . i never seen that there before.. but i clicked on it and it marked solved. Thanx doode for all your help with this ARRAY thingy!... I really appreciate it!
  12. Hi, I just looked and found that that I only had $row_['tableid'] for the name variable thats all i had. IO guess thats why it gave ta DIFFERNT name for each radio button set. and allowed me to change them individually. Thats why it ONLY SEEMED like it was working at the time. But i remember why i didnt leave it that way, like i say the array wasnt doing anthing for STATUS and i knew that the radio Button NAME had to have eb able to know it was for STATUS... thats why I removed that too!. and started that part from scratch too!.. Then I was just totally lost with the ARRAY as i never had to work with an array! doode, your update code works. The database is UPDATED.. perfectly.. NOw I just HAVE to FULLY understand what you did so I would know what to do if i was to have to work with an ARRAY again! ) Do I mark this [solved] or does the Moderator do that? Cheerz and thanks again for your help!
  13. Good Morning... yeab thats when i pasted it here.. when i first posted.. it wasnrt workign.. but i meant way before i camer here as i say it was working at one time. but the once i couldnt get it to wsave the data.. i reddid the whole thing from scratch and it never worked right since. Thats when i posted here!! ) I will try at update fix now! and get back!!
  14. when i hit the update button on the bottom ...the ARRAY printout shows the numbers being changed to 1 or 2 on what ever crate row i change.. but the RADIO buttons themselfs STILL stay on the WHITE colour (0) one! hmm.. well i am tired now.. and i will try again tommorrow!..
  15. FUnny.. thats how i had it before.. wiht the RADIO NAME.... just using the simple $row['tableid'] before.. maybe that when it WAS working before... stupid me!! anyways the UPDATE code isnt working!! nothign is being updated to the databse!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.