Jump to content

ROCKINDANO

Members
  • Posts

    143
  • Joined

  • Last visited

    Never

Everything posted by ROCKINDANO

  1. do i need anything else to work with resizing images in php
  2. could it be that i need a setting in my php.ini file or any libs?
  3. this is how my files are root(folder) |_images(folder) |_official flyernail.jpg |_resize_image.php |_mail.php
  4. and if i type it in the address bar it gives me a blank page localhost/resize_image.php/images/resize_image.php?file=Official flyernail.jpg this is what i typed in the addr bar
  5. this is what i get: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL /images/resize_image.php was not found on this server.</p> </body></html>
  6. this is my source code <img src="images/resize_image.php?file=Official flyernail.jpg" border="1" class="floatright" title="Official flyernail.jpg" alt="Official flyernail.jpg" /> shouldn't the src path be something like: images/official flyernail.jpg instead of images/resize_image.php?file=Official flyernail.jpg
  7. so why doesn't it show the image? if i browse through my main code and see the img tag and click on it it takes me to a page that has file not found.
  8. can you get it from the attachment? [attachment deleted by admin]
  9. well i can't seem to find the problem. the script gets everything from the file name to size etc... but can't display it to the browser.
  10. oh k i think i know whats wrong. would it be the location of the script (the directory where stored) and the location of the image file?
  11. How would i do that?
  12. i'm sorry but how would i do that?
  13. it gets the image because it gives me the name of the file. and this is what the source code shows as the image tag path: <img src="images/resize_image.php?file=forbeslogo.jpg" border="1" class="floatright" title="forbeslogo.jpg" alt="forbeslogo.jpg" /> and the title and alt attributes in the img tag show the name of the file. but don't know why it is not showing.
  14. what do you mean?
  15. still no image. i am quessing that the re size script is not getting the file name
  16. ok i changed it to print "<img src=\"images/resize_image.php?file=.$pic.\" border=\"1\" class=\"floatright\" title=\".$pic.\" alt=\"$pic\" />";
  17. here is my main page <?php if(!($db = @ mysql_connect('localhost', 'user', 'pass'))) { print "Error: Could not connect to our database sorry for any inconvenience.<br /> Please try at a later time."; } //select which database you want to edit mysql_select_db("db"); // $news_id=mysql_real_escape_string($_GET[news_id]); $query = "SELECT * FROM news ORDER BY news_id DESC LIMIT 6"; $result = mysql_query($query); ?> <div style="background:#cfdbea; height:180px;padding: 5px; font-size: 14px"> <div style="background:#FFFFFF; height:160px; padding:10px;"> <?php $i = 1; while ($r=mysql_fetch_array($result)) { $news_id=$r["news_id"]; $title=$r["title"]; $fulldesc=$r["fulldesc"]; $pic=$r["file"]; ?> <div id="slide<?php print $i; ?>" class='slides'> <div class='slideTitle' style="padding-bottom:2px;"> <?php if ($pic!="") { print "<img src=\"images/resize_image.php?file = '.$pic.'\" border=\"1\" class=\"floatright\" title=\".$pic.\" alt=\"$pic\" />"; // print '<img src="images/'.$pic.'" title="" border="0" width="170" height="135" class="floatright" style="margin-left: 5px; border: 2px solid #CCCCCC; padding: 3px; background: #9bbdfd;" />'; } else print '<img src="images/imageholdershow.jpg" title="" border="2" width="170" height="135" class="floatright" style="margin-left: 5px; border: 2px solid #CCCCCC; padding: 3px; background: #9bbdfd;" />'; ?> <?php print "<p style='padding: 0px;'><a href='newsevents.php?news_id={$news_id}' style='color:#9F0000; text-decoration:underline'>".$title."</a>"; ?></div> <p><?php print substr($fulldesc = $r["fulldesc"], 0, 280); print "&#8230; <a href='newsevents.php?news_id={$news_id}' style=\"font-size: 11px\">Full Story ยป</a></p>"; ?> </div> <?php $i++; }//end while loop ?>
  18. well that still didn't work. for some reason its not passing the image file name to the script
  19. Can someone tell me why this isn't working? i am trying to resize an image that gets uploaded to a dir. and db stores the file name under the "file" column. this is the page that displays the image : print '<img src="images/resize_image.php?file=$pic" title="" border="0" width="170" height="135" class="floatright" style="margin-left: 5px; border: 2px solid #CCCCCC; padding: 3px; background: #9bbdfd;" />'; this is the page that resizes the images: <?php $pic = $HTTP_GET_VARS['file']; print $pic; print "image "; if (!max_width) $max_width = 80; if (!max_height) $max_height = 60; $size = GetpicSize($pic); $width = $size[0]; $height = $size[1]; $x_ratio = $max_width / $width; $y_ratio = $max_height / $height; if ( ($width <= $max_width) && ($height <= $max_height) ) { $tn_width = $width; $tn_height = $height; } else if (($x_ratio * $height) < $max_height) { $tn_height = ceil($x_ratio * $height); $tn_widht = $max_width; } else { $tn_width = ceil($y_ratio * $width); $tn_height = $max_height; } $src = ImageCreateFromJpeg($pic); $dst = ImageCreate($tn_width, $tn_height); ImageCopyResize($dt, $src, 0,0,0,0, $tn_width, $tn_height, $width,$height); header('Content-type: image/jpeg'); ImageJpeg($dst, null, -1); ImageDestroy($src); ImageDestroy($dst); ?>
  20. thank you so so so so so so much. it worked. was uploading the pic to wrong destination. again THANK YOU SO MUCH DUDE.
  21. well it does print out the file name in the file column in my db.
  22. well it still doesn't show the pic. i am incrementing the $i by one so the slideshow works. but i want it to grab a pic that is related to each story. i have the pic name in a record in a db.
  23. well i was thinking of just storing the flie name in the db record and trying to put the file name on the src="" tag. this is what i have don't know if its right. --> <?php $i = 1; while ($r=mysql_fetch_array($result)) { $news_id=$r["news_id"]; $title=$r["title"]; $fulldesc=$r["fulldesc"]; $pic=$r["file"]; ?> <div id="slide<?php print $i; ?>" class='slides'> <?php print '<img src="images/$pic" title="" border="0" class="floatright" />'; ?> this is my while loop where i print out everything onto the page. can you help me with this?
  24. i was wondering if there is a way to have a list of stories and a pic with every story. grab the pic (file name ) from a db that holds the stories along with a pic related to that story. can someone point me to the right direction for this?
  25. hey it worked!!!!!!! ah. thank you Justlikelcarus.
×
×
  • 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.