
ROCKINDANO
Members-
Posts
143 -
Joined
-
Last visited
Never
Everything posted by ROCKINDANO
-
do i need anything else to work with resizing images in php
-
could it be that i need a setting in my php.ini file or any libs?
-
this is how my files are root(folder) |_images(folder) |_official flyernail.jpg |_resize_image.php |_mail.php
-
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
-
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>
-
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
-
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.
-
can you get it from the attachment? [attachment deleted by admin]
-
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.
-
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?
-
How would i do that?
-
i'm sorry but how would i do that?
-
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.
-
what do you mean?
-
still no image. i am quessing that the re size script is not getting the file name
-
ok i changed it to print "<img src=\"images/resize_image.php?file=.$pic.\" border=\"1\" class=\"floatright\" title=\".$pic.\" alt=\"$pic\" />";
-
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 "… <a href='newsevents.php?news_id={$news_id}' style=\"font-size: 11px\">Full Story ยป</a></p>"; ?> </div> <?php $i++; }//end while loop ?>
-
well that still didn't work. for some reason its not passing the image file name to the script
-
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); ?>
-
thank you so so so so so so much. it worked. was uploading the pic to wrong destination. again THANK YOU SO MUCH DUDE.
-
well it does print out the file name in the file column in my db.
-
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.
-
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?
-
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?
-
hey it worked!!!!!!! ah. thank you Justlikelcarus.