S.Cosmin Posted April 28, 2011 Posted April 28, 2011 Hi everyone, i come with a new problem... How can i put images to my items? For example, for the AK47 a picture wit AK47 for a knife a knife picture... Thanks you Quote
galdikas Posted April 28, 2011 Posted April 28, 2011 place it in images directory, and append the filename to URL???? Quote
S.Cosmin Posted April 28, 2011 Author Posted April 28, 2011 Yes mister, but where can i place the URL? Quote
rulerofzu Posted April 28, 2011 Posted April 28, 2011 http://makewebgames.io/showthread.php/23914-mccode-v2-Items-Pic-mod?highlight=item+pics Please try and search for what you need. Quote
S.Cosmin Posted April 28, 2011 Author Posted April 28, 2011 I have fallow for 1 week this mod tutorial and i become an error. I try one more time. If doesn't work, i don't know what i am do. Quote
rulerofzu Posted April 28, 2011 Posted April 28, 2011 You will need to work through the code. Due to a change in forum software the certain parts have been changed. for example in the code needs to be replaced with <img src= Quote
S.Cosmin Posted April 29, 2011 Author Posted April 29, 2011 (edited) I have to do what you say and replace with that, it's work, i dont become error but i don't see that picture...Any solution? Something wrong on my code? <?php include "globals.php"; //look up item $_GET['ID'] = abs((int) $_GET['ID']); $itmid=$_GET['ID']; if(!$itmid) { print "Invalid item ID"; } else { $q=$db->query("SELECT i.*,it.* FROM items i LEFT JOIN itemtypes it ON i.itmtype=itmtypeid WHERE i.itmid=$itmid LIMIT 1"); if (!$db->num_rows($q)) { print "Invalid item ID"; } else { $id=$db->fetch_row($q); if($id['itmpic']) { $itmpic = "<tr style='background: gray;'><td colspan='2' style='text-align: center;'><img src='itmpics/$id'></td></tr>"; } print "<table width=75% class='table' cellspacing='1'><tr style='background: gray;'><th colspan=2><b>Looking up info on {$id['itmname']}</b></th></tr>$itmpic<tr bgcolor=#dfdfdf><td colspan=2>The <b>{$id['itmname']}</b> is a/an {$id['itmtypename']} <span class='highlight'>Item</span> - <b>{$id['itmdesc']}</b></th><tr style='background: gray;'><th colspan=2><span class='highlight'>Item</span> Info</th></tr><tr style='background:gray'><th><span class='highlight'>Item</span> Buy Price</th><th><span class='highlight'>Item</span> Sell Price</th></tr><tr><td>"; if($id['itmbuyprice']) { print money_formatter($id['itmbuyprice']); } else { print "N/A"; } print "</td><td>"; if($id['itmsellprice']) { print money_formatter($id['itmsellprice']); } else { print "N/A</td></tr></table>"; } } } $h->endpage(); ?> Edited April 29, 2011 by S.Cosmin Quote
rulerofzu Posted April 29, 2011 Posted April 29, 2011 Well my suggestion would be for you to learn from your mistakes. View the source code and/or inspect the element in question. It will clearly show you where your going wrong. There is no image as your not calling the image correctly. <img src='itmpics/$id'> Quote
S.Cosmin Posted April 29, 2011 Author Posted April 29, 2011 Man, you kill me. Why you don't give me the right code. I can't learn php in 1 day :) I can't do this, still no img... Quote
funnyplox Posted April 29, 2011 Posted April 29, 2011 (edited) you can skip the complications, takes longer but you can just put <img src="yourimage.jpg"> or <img src="images/yourimage.jpg"> into the name field in your database so then it shows up everywhere item does. you may want to add <br> to make the spacing of name and image look better. but youll figure it out from there. you have the images in the main directory or in images folder. the <img src> just calls it out for whereevr the image shows (inventory, battle, shops etc) Edited April 29, 2011 by Dominion Don't post insults... removed from post Quote
rulerofzu Posted April 29, 2011 Posted April 29, 2011 Just look at <img src='itmpics/$id'> how about <img src='itmpics/".$id."'> Quote
funnyplox Posted April 29, 2011 Posted April 29, 2011 thats fine and dandy, but then you cant edit through staff panel, just a pain in the ass. Just look at <img src='itmpics/$id'> how about <img src='itmpics/".$id."'> Quote
rulerofzu Posted April 29, 2011 Posted April 29, 2011 Items are created through the admin panel. What you going to do hard code all your item pics into the game. Laughable. Quote
funnyplox Posted April 29, 2011 Posted April 29, 2011 whats the old saying? keep it simple stupid. thats the point, you are forced to edit items through database if you add item pics that way. staff panel doesn't compute. Items are created through the admin panel. What you going to do hard code all your item pics into the game. Laughable. Quote
Dominion Posted April 29, 2011 Posted April 29, 2011 whats the old saying? keep it simple stupid. thats the point, you are forced to edit items through database if you add item pics that way. staff panel doesn't compute. edit the staff file so you can add pictures through it? No need to go to the database every time... Quote
funnyplox Posted April 29, 2011 Posted April 29, 2011 same amount of work either way. why go with a way you are having issues understanding when theres a simpler way that works. edit the staff file so you can add pictures through it? No need to go to the database every time... Quote
Dominion Posted April 29, 2011 Posted April 29, 2011 same amount of work either way. why go with a way you are having issues understanding when theres a simpler way that works. Well that's fine if you find it simple, but that's not you being “forced” then is it? People do things differently. Quote
funnyplox Posted April 29, 2011 Posted April 29, 2011 it doesn't matter how or when you reach the top of the mountain. its how you get there. Well that's fine if you find it simple, but that's not you being “forced” then is it? People do things differently. Quote
S.Cosmin Posted April 29, 2011 Author Posted April 29, 2011 Damn don't want to work...i have change all...stell no pics...i do know what i'm gone do Quote
Dominion Posted April 29, 2011 Posted April 29, 2011 it doesn't matter how or when you reach the top of the mountain. its how you get there. Sometimes the scenic route is better then the direct one, and sometimes direct is needed... It depends on the person. How you do it is down to you, the point is the staff panel does not force you to take one way as you suggested. Anyways you get the point. Quote
rulerofzu Posted April 29, 2011 Posted April 29, 2011 Replace line 21 with this $itmpic = "<tr style='background: gray;'><td colspan='2' style='text-align: center;'><img src='images/itmpics/".$id['itmpic']."'></td></tr>"; } Go through line 22 and replace any double quotes with single quotes. It should be class='highlight' not "highlight" Quote
S.Cosmin Posted April 29, 2011 Author Posted April 29, 2011 Merci mister, work nice. Thanks all of you :) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.