Jump to content

rajeevthomas

Members
  • Posts

    26
  • Joined

  • Last visited

Everything posted by rajeevthomas

  1. Thank you Jaques1 with your help my code is now HTML-escaped...thanks again!.
  2. Jaques, thank you!. Sorry about my late reply. And thank you for your code. Now I have somewhere to start from. The array idea is cool. is 'html_escape' a PHP function? I couldn't find out much about it.
  3. Thank you guys. Looking at your answers I realize that I did not ask my question right. I am sorry about that. My case is a bit different I think. I think it is because I am trying to create the link from inside PHP. My code is $result_final .= "<a href=viewgallery.php?cname=$cname&pcaption=" . $caption_array[$next] . "><img src='/photos/assets/left.png' alt='left navigation'></a>"; So based on your answers ... I changed the links like this $result_final .= "<a href=\"viewgallery.php?cname=$cname&pcaption=" . $caption_array[$next] . "\"><img src='/photos/assets/left.png' alt='left navigation'></a>"; It really works. Thank you for the suggestions. No more errors.... ( for now ) Just out of curiosity, is this a bad way of creating links? Is this a hideous code? Thank you for helping me,....
  4. Hi Everyone.. I am not sure if I should post this question here. I would like to fix this problem using PHP rather than HTML. I am new to PHP. This code is part of an old PHP gallery file. I am trying to validate my site but the site's links have some characters that makes the link throw errors in W3C Validator. So I tried to replace the characters with HTML characters for example ? are now replaced by ? so my original link before using valid HTML characters looked like www.awebsite.com/viewgallery.php?cname=Colorado-Fall&pcaption=Lost-In-The-art And now it looks like this ... www.awebsite.com/viewgallery.php?cname=Colorado-Fall&pcaption=Lost-In-The-art But now W3C Validator shows an error like this The ? for replacing ? seems to be the problem.The & is highlighted in red. What am I doing wrong? How can I validate this link? I tried to use single or double quotes around HTML characters but that breaks my links and they won't work after that. Any tips will be appreciated...
  5. Thank you Mac_gyver, I will be the only one uploading. But I will learn how to report back the errors... thanks again...
  6. Hi everyone... I am a beginner. For a gallery I have, I am trying to upload thumbnails and sharpen them using image convolution. I am not sure I am doing the right thing or not. I am not getting arrors but I do not see any sharpening effect!! So I know I am dead wrong some where...! Please help me with this.... I am also not st sure I have the right source for $img... This is where I need some help... [color=red] $img = ImageCreateTrueColor ( $thumbnail_width, $thumbnail_height); $sharpenMatrix = array ( array(-1.2, -1, -1.2), array(-1, 20, -1), array(-1.2, -1, -1.2) ); // calculate the sharpen divisor $divisor = array_sum(array_map('array_sum', $sharpenMatrix)); $offset = 0; // apply the matrix imageconvolution($img, $sharpenMatrix, $divisor, $offset); [/color] This is my code for the upload file.... include("config.inc.php"); if(!$_POST) { header("Location: preupload.php"); exit(); } // initialization $result_final = ""; $counter = 0; // List of our known photo types $known_photo_types = array( 'image/pjpeg' => 'jpg', 'image/jpeg' => 'jpg', 'image/gif' => 'gif', 'image/bmp' => 'bmp', 'image/x-png' => 'png' ); // GD Function List $gd_function_suffix = array( 'image/pjpeg' => 'JPEG', 'image/jpeg' => 'JPEG', 'image/gif' => 'GIF', 'image/bmp' => 'WBMP', 'image/x-png' => 'PNG' ); // Fetch the photo array sent by preupload.php $photos_uploaded = $_FILES['photo_filename']; // Fetch the photo caption array $photo_caption = $_POST['photo_caption']; // Fetch the photo caption array $photo_description = $_POST['photo_description']; // Fetch the photo caption array $photo_keyword = $_POST['photo_keyword']; while( $counter <count($_FILES['photo_filename']['tmp_name']) ) { if($photos_uploaded['size'][$counter] > 0) { if(!array_key_exists($photos_uploaded['type'][$counter], $known_photo_types)) { $result_final .= "File ".($counter+1)." is not a photo<br />"; } else { mysql_query( "INSERT INTO gallery_photos ( `photo_filename`, `photo_caption`, `photo_description`, `photo_keywords`, `photo_category` ) VALUES( '0', '".addslashes($photo_caption[$counter])."', '".addslashes($photo_description[$counter])."', '".addslashes($photo_keyword[$counter])."', '".addslashes($_POST['category'])."')" ) or die(mysql_error() . 'Photo not uploaded'); $new_id = mysql_insert_id(); $filetype = $photos_uploaded['type'][$counter]; $extention = $known_photo_types[$filetype]; $filename = $new_id.".".$extention; mysql_query( "UPDATE gallery_photos SET photo_filename='".addslashes($filename)."' WHERE photo_id='".addslashes($new_id)."'" ); // Store the orignal file copy($photos_uploaded['tmp_name'][$counter], $images_dir."/".$filename); // Let's get the Thumbnail size $size = GetImageSize( $images_dir."/".$filename ); if($size[0] > $size[1]) { $thumbnail_width = 500; $thumbnail_height = (int)(500 * $size[1] / $size[0]); } else { $thumbnail_width = (int)(500 * $size[0] / $size[1]); $thumbnail_height = 500; } // Build Thumbnail with GD 1.x.x, you can use the other described methods too $function_suffix = $gd_function_suffix[$filetype]; $function_to_read = "ImageCreateFrom".$function_suffix; $function_to_write = "Image".$function_suffix; // Read the source file $source_handle = $function_to_read ( $images_dir."/".$filename ); if($source_handle) { // Let's create an blank image for the thumbnail $destination_handle = ImageCreateTrueColor ( $thumbnail_width, $thumbnail_height ); // Now we resize it imagecopyresampled( $destination_handle, $source_handle, 0, 0, 0, 0, $thumbnail_width, $thumbnail_height, $size[0], $size[1] ) ; } [color=red] $img = ImageCreateTrueColor ( $thumbnail_width, $thumbnail_height); $sharpenMatrix = array ( array(-1.2, -1, -1.2), array(-1, 20, -1), array(-1.2, -1, -1.2) ); // calculate the sharpen divisor $divisor = array_sum(array_map('array_sum', $sharpenMatrix)); $offset = 0; // apply the matrix imageconvolution($img, $sharpenMatrix, $divisor, $offset); [/color] // Let's save the thumbnail $function_to_write( $destination_handle, $images_dir."/tb_".$filename, 100 ); ImageDestroy($destination_handle ); // $result_final .= "<img src='".$images_dir. "/tb_".$filename."' /> File ".($counter+1)." Added<br />"; } } $counter++; } // Print Result echo <<<__HTML_END <html> <head> <title>Photos uploaded</title> </head> <body> $result_final </body> </html> __HTML_END;
  7. Thank you everyone..this is now is SOLVED...
  8. Hi everyone... I have a thumbnail page that is putting out tables that are skewed and I am not able to use CSS properly because of that. Is there anyways I can change the PHP output? This is my code... I think the highlighted area is responsible for my tables? But it is mismatching the <tr> and <td> tags.... I really want it to show a structured table.. like <table> <tr> <td> </td> </tr> </table> // Thumbnail Listing else if( $cid && empty( $pid ) ) { $number_of_thumbs_in_row = 4; // If current page number, use it // if not, set one! if(!isset($_GET['page'])){ $page = 1; } else { $page = $_GET['page']; } // Define the number of results per page $max_results = 400; // Figure out the limit for the query based // on the current page number. $from = (($page * $max_results) - $max_results); $result = mysql_query(" SELECT photo_id , photo_caption , photo_filename , photo_category FROM gallery_photos WHERE photo_category='".addslashes($cid)."' LIMIT $from, $max_results "); $nr = mysql_num_rows( $result ); if( empty( $nr ) ) { $result_final = "\t<tr><td>No Photos found</td></tr>\n"; } else { while( $row = mysql_fetch_array( $result ) ) { $result_array[]= "<a href='viewgallery.php?cid=$cid&pid=".$row[0]."'><img src='".$images_dir."/tb_".$row[2]."' border='0' alt='".$row[1]."' class='img'/></a>"; } $result = mysql_query( "SELECT category_name FROM gallery_category WHERE category_id='".addslashes($cid)."'" ); list($category_name) = mysql_fetch_array( $result ); mysql_free_result( $result ); $result_final = "<tr>\n\t<td> <span class='navlinks'><a href=viewgallery.php>Albums</a></span><font color=#ff0000> >&gt </font> <span class='navlinks'><a href=viewgallery.php?cid=$cid>$category_name</a></span><br><br/><br/><br/></td>\n</tr>\n"; foreach($result_array as $thumbnail_link) { if($counter == $number_of_thumbs_in_row) { $counter = 1; [b][size=24pt][size=18pt][b]$result_final .= "\n</tr>\n<tr>\n";[/b][/size][/size][/b] } else $counter++; [b][size=18pt] $result_final .= "\t<td>".$thumbnail_link."</td>\n";[/size][/b] } if($counter) { And my HTML output shows the tables like this... <body> <table width='100%' border='0' align='center' style='width: 80%;'> <tr> <td> <span class='navlinks'><a href=viewgallery.php>Albums</a></span><font color=#ff0000> >&gt </font> <span class='navlinks'><a href=viewgallery.php?cid=1>Abstract</a></span><br><br/><br/><br/></td> </tr> <td><a href='viewgallery.php?cid=1&pid=240'><img src='photos/tb_240.jpg' border='0' alt='End Of Day' class='img'/></a></td> <td><a href='viewgallery.php?cid=1&pid=239'><img src='photos/tb_239.jpg' border='0' alt='A Photographer's Dream' class='img'/></a></td> <td><a href='viewgallery.php?cid=1&pid=238'><img src='photos/tb_238.jpg' border='0' alt='Heaven's View' class='img'/></a></td> <td><a href='viewgallery.php?cid=1&pid=237'><img src='photos/tb_237.jpg' border='0' alt='Colorful World ' class='img'/></a></td> </tr> <tr> <td><a href='viewgallery.php?cid=1&pid=241'><img src='photos/tb_241.jpg' border='0' alt='' class='img'/></a></td> <td><a href='viewgallery.php?cid=1&pid=242'><img src='photos/tb_242.jpg' border='0' alt='' class='img'/></a></td> <td><a href='viewgallery.php?cid=1&pid=243'><img src='photos/tb_243.jpg' border='0' alt='' class='img'/></a></td> <td><a href='viewgallery.php?cid=1&pid=244'><img src='photos/tb_244.jpg' border='0' alt='' class='img'/></a></td> </tr> <tr> <td><a href='viewgallery.php?cid=1&pid=245'><img src='photos/tb_245.jpg' border='0' alt='' class='img'/></a></td> <td><a href='viewgallery.php?cid=1&pid=246'><img src='photos/tb_246.jpg' border='0' alt='' class='img'/></a></td> <td><a href='viewgallery.php?cid=1&pid=247'><img src='photos/tb_247.jpg' border='0' alt='' class='img'/></a></td> <td><a href='viewgallery.php?cid=1&pid=248'><img src='photos/tb_248.jpg' border='0' alt='' class='img'/></a></td> </tr> <tr> <td><a href='viewgallery.php?cid=1&pid=249'><img src='photos/tb_249.jpg' border='0' alt='' class='img'/></a></td> <td><a href='viewgallery.php?cid=1&pid=250'><img src='photos/tb_250.jpg' border='0' alt='' class='img'/></a></td> <td><a href='viewgallery.php?cid=1&pid=251'><img src='photos/tb_251.jpg' border='0' alt='' class='img'/></a></td> <td><a href='viewgallery.php?cid=1&pid=252'><img src='photos/tb_252.jpg' border='0' alt='' class='img'/></a></td> </tr> <tr> <td><a href='viewgallery.php?cid=1&pid=253'><img src='photos/tb_253.jpg' border='0' alt='' class='img'/></a></td> <td><a href='viewgallery.php?cid=1&pid=254'><img src='photos/tb_254.jpg' border='0' alt='' class='img'/></a></td> <td><a href='viewgallery.php?cid=1&pid=255'><img src='photos/tb_255.jpg' border='0' alt='' class='img'/></a></td> </table> </body>
  9. Cristian... It is not a website yet... But when you get the page you will see that the thumbnails are spread apart and I cannot change the space in between or the space from left to right.... thank you Cristian... http://www.rajeevthomas.com/viewgallery.php
  10. Hello everyone, I am new here and new to the coding world! I am trying to position my tables for my thumbnail gallery and it looks very different between IE7 and Firefox. Margins really get messed up. I am adding my codes below...how can I add some CSS to my tables other than width? Width seems to be the only thing that works. When I use width it increases margin between the thumbnails so much. And it all look so different between browsers... HTML ... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Photography</title> </head> <body> <table border='0' style='margin: 0px ; padding: 0px ;'> <tr> <td> <span class='navlinks'><a href=viewgallery.php>Albums</a></span><font color=#ff0000> >&gt </font> <span class='navlinks'><a href=viewgallery.php?cid=1>Abstract</a></span><br><br/><br/><br/></td> </tr> <td class=thumbs ><a href='viewgallery.php?cid=1&pid=240'><center/><img src='photos/tb_240.jpg' border='0' alt='End Of Day' class='img'/></a></td> <td class=thumbs ><a href='viewgallery.php?cid=1&pid=239'><center/><img src='photos/tb_239.jpg' border='0' alt='A Photographer's Dream' class='img'/></a></td> <td class=thumbs ><a href='viewgallery.php?cid=1&pid=238'><center/><img src='photos/tb_238.jpg' border='0' alt='Heaven's View' class='img'/></a></td> <td class=thumbs ><a href='viewgallery.php?cid=1&pid=237'><center/><img src='photos/tb_237.jpg' border='0' alt='Colorful World ' class='img'/></a></td> </tr> <tr class=thumbs> <td class=thumbs ><a href='viewgallery.php?cid=1&pid=241'><center/><img src='photos/tb_241.jpg' border='0' alt='' class='img'/></a></td> <td class=thumbs ><a href='viewgallery.php?cid=1&pid=242'><center/><img src='photos/tb_242.jpg' border='0' alt='' class='img'/></a></td> <td class=thumbs ><a href='viewgallery.php?cid=1&pid=243'><center/><img src='photos/tb_243.jpg' border='0' alt='' class='img'/></a></td> <td class=thumbs ><a href='viewgallery.php?cid=1&pid=244'><center/><img src='photos/tb_244.jpg' border='0' alt='' class='img'/></a></td> </tr> <tr class=thumbs> <td class=thumbs ><a href='viewgallery.php?cid=1&pid=245'><center/><img src='photos/tb_245.jpg' border='0' alt='' class='img'/></a></td> <td class=thumbs ><a href='viewgallery.php?cid=1&pid=246'><center/><img src='photos/tb_246.jpg' border='0' alt='' class='img'/></a></td> </table> </body> And the CSS part is...
  11. Oliverj777... I tired that but it just shows up as letters as it is on the final output screen. :'(
  12. Hi everyone.... I have a simple search.php And I want to include that in my html output page. I tried using <?php include ('search.php'); ?> Below is my HTML code which is part of a php file...what am I doing wrong here? // Final Output echo <<<__HTML_END <html> <head> <title>Photography</title> </head> <body> <table width='100%' border='0' align='center' style='width: 100%;'> $result_final <?php include("search.php");?> </table> </body> </html> __HTML_END;
  13. Thank you for your help and time... you are so kind...
  14. Joel24 thank you very much..! From what you said I am very interested to know how I can modify it to bring links to the photos or photos? Can you gimme some directions Joel?
  15. Mmmm..hope I am saying this right... in the database there are only image information. And the php file pulls the image based on the information. When I look at my database I only see image info not direct links to them. I hope that answers to your question...how do we do the search you have mentioned?
  16. Hi everyone... I just came across http://www.phpfreaks.com/tutorial/simple-sql-search . And it works for me. But I am making a gallery. If I have a database with images, keywords, captions, how do I create a search box to search for images? Are there any tutorials? is it possible to make changes to this tutorial to bring up just images? Any directions will help...
  17. Thank you .....from every post here I walk away with something that I learned... thank you ...your reply makes sense... thanks again...
  18. That's awesome!! That did it.. that worked... you just showed that I have a lot to learn about PHP! Thank you very very much ...
  19. Hi everyone... please help me with this. I have a gallery that I am working on. Part of that are two files upload.php and preupload.php which upload pics. And it does its job successfully BUT it shows an error 'Notice: Undefined offset: 9 in C:\wamp\www\upload.php on line 34' My line 34 is if($photos_uploaded['size'][$counter] > 0) . My whole code for the upload.php is <?php include("config.inc.php"); // initialization $result_final = ""; $counter = 0; // List of our known photo types $known_photo_types = array( 'image/pjpeg' => 'jpg', 'image/jpeg' => 'jpg', 'image/gif' => 'gif', 'image/bmp' => 'bmp', 'image/x-png' => 'png' ); // GD Function List $gd_function_suffix = array( 'image/pjpeg' => 'JPEG', 'image/jpeg' => 'JPEG', 'image/gif' => 'GIF', 'image/bmp' => 'WBMP', 'image/x-png' => 'PNG' ); // Fetch the photo array sent by preupload.php $photos_uploaded = $_FILES['photo_filename']; // Fetch the photo caption array $photo_caption = $_POST['photo_caption']; while( $counter <= count($_FILES['photo_filename']['tmp_name']) ) { if($photos_uploaded['size'][$counter] > 0) { if(!array_key_exists($photos_uploaded['type'][$counter], $known_photo_types)) { $result_final .= "File ".($counter+1)." is not a photo<br />"; } else { mysql_query( "INSERT INTO gallery_photos( `photo_filename`, `photo_caption`, `photo_category` ) VALUES( '0', '".addslashes($photo_caption[$counter])."', '".addslashes($_POST['category'])."')" ) or die(mysql_error() . 'Photo not uploaded'); $new_id = mysql_insert_id(); $filetype = $photos_uploaded['type'][$counter]; $extention = $known_photo_types[$filetype]; $filename = $new_id.".".$extention; mysql_query( "UPDATE gallery_photos SET photo_filename='".addslashes($filename)."' WHERE photo_id='".addslashes($new_id)."'" ); // Store the orignal file copy($photos_uploaded['tmp_name'][$counter], $images_dir."/".$filename); // Let's get the Thumbnail size $size = GetImageSize( $images_dir."/".$filename ); if($size[0] > $size[1]) { $thumbnail_width = 200; $thumbnail_height = (int)(200 * $size[1] / $size[0]); } else { $thumbnail_width = (int)(200 * $size[0] / $size[1]); $thumbnail_height = 200; } // Build Thumbnail with GD 1.x.x, you can use the other described methods too $function_suffix = $gd_function_suffix[$filetype]; $function_to_read = "ImageCreateFrom".$function_suffix; $function_to_write = "Image".$function_suffix; // Read the source file $source_handle = $function_to_read ( $images_dir."/".$filename ); if($source_handle) { // Let's create an blank image for the thumbnail $destination_handle = ImageCreateTrueColor ( $thumbnail_width, $thumbnail_height ); // Now we resize it ImageCopyResized( $destination_handle, $source_handle, 0, 0, 0, 0, $thumbnail_width, $thumbnail_height, $size[0], $size[1] ); } // Let's save the thumbnail $function_to_write( $destination_handle, $images_dir."/tb_".$filename, 99 ); ImageDestroy($destination_handle ); // $result_final .= "<img src='".$images_dir. "/tb_".$filename."' /> File ".($counter+1)." Added<br />"; } } $counter++; } // Print Result echo <<<__HTML_END <html> <head> <title>Photos uploaded</title> </head> <body> $result_final </body> </html> __HTML_END; ?>
  20. foxsoup... you solved it...thank you so much!!
  21. Hi... I am really new to this. Please help me with this... as part of a gallery, I have categories and a thumbnail. As of now the title/link to the gallery shows up on the side of the thumbnail. How can I place the link below the thumbnail? Here is the code $result_array[] = "<a href='viewgallery.php?cid=".$row[0]."'>".$row[1]."<img src='/photos/categoryimages/category".$row[0].".jpg' border=0 height='133px' width='200px' </a>"; Thank you for your help...
  22. l4nc3r.... I tied many tutorials... but I am not really intelligent enough to grasp what was in some of the tutorials. One example is Mayank's Dynamic PHP gallery in minutes on sitepoint site. God.... I tried it for many days. But got stuck and finding help for that thing was hard. But you gave me a great start... when I look at php I have one question all the time! ..
  23. Hi ... I am a total newbie. I have been trying to build a simple gallery with Dreamweaver and a database. I am able to show larger image, from thumbs. I used a database, recordset, repeat regions. But I do not know how to show categories. Can anyone give me any directions? Any tutorials? I am ready to provide you with any info you need...What I need to do is to be able click on gallery thumbs to go to image thumbs in that gallery category and then go to the larger version.... please help...:shifty:
  24. Thank you for that tip... I am attaching a snapshot of my page source. It looks messed up ( my expertise is only get me that far! ) ..I do not know how to fix it. What kind of info is needed? I will give you anything you want ..if you can help me :-) I am attaching my index.php also.... Thanks again... [attachment deleted by admin]
  25. Hi everyone... I am not a code guy... I am very new at this thing. I am a photographer and trying to get something going with pixelpost. I am trying to get the pictures in each category cycle just in that category. Pixelposts have addons or plug in to make this work ..link to the add on is http://www.pixelpost.org/extend/addons/advanced-next-mod/reviews/ But after activating it..I am missing my next and prev buttons and replaced by some category numbers(?). It looks like this http://www.rajeevthomas.com/gallery/index.php?showimage=7&category=2 Below is where I have added the tags.. Can anyone help me to figure out what is going on here? Thank you... [attachment deleted by admin]
×
×
  • 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.