Jump to content
MakeWebGames

car images - simple way


m1ll1k3n

Recommended Posts

ive come up with a mad easy way of giving cars images 

please see a basic sample at criminalempire.co.uk

username:tony

password:dan123

go to garages and and takea  look at the couple of example cars that are there

if youde like help on how to do this ( takes around 10 mins ) please pm me 

Link to comment
Share on other sites

5 hours ago, m1ll1k3n said:

ive come up with a mad easy way of giving cars images 

please see a basic sample at criminalempire.co.uk

username:tony

password:dan123

go to garages and and takea  look at the couple of example cars that are there

if youde like help on how to do this ( takes around 10 mins ) please pm me 

This must be the worst and stupidest way I've ever seen this implemented into a game, you have pretty much just posted the image into a forum topic and just link to the topic id.

Why don't you just add a column to the cars table like CA_image and fetch it along with all the other data in garage, so simple to do. you could add a new method if you wanted a car info page but if not you could just put the images on the default garage view.

Edited by urbanmafia
Link to comment
Share on other sites

47 minutes ago, m1ll1k3n said:

hense the simple bit becuase you dont have do anything atall like that .. its simple and easy 

yes but the other way is even more simple it takes 1 column and an img tag on your garage page. Posting each one of them topics up takes alot longer doing it the real way would take around 5 mins and would look a lot more appealing.

 

ALTER TABLE `cars` ADD `CA_pic` VARCHAR(200) NOT NULL AFTER `CA_name`;

in garage.tpl.php find on line 15

<th>name</th>

add before

<th>Image</th>


then find on line 34

<td>{name}</td>

add before

<td><img src="{image}" alt="{name}" width="75" height="75"/></td>

in garage.inc.php find on line 27

"name" => $car->CA_name, 

add before 

"image" => $car->CA_pic, 


after update your images of your cars

just a basic way of doing it. would still be more advanced ways but this just shows what can be done in short time.

 

This is what the result would be.

 

Capture.PNG.b3edf1d50b7bd72af07ebd1a35dbc8d9.PNG

 

Edited by urbanmafia
  • Like 3
  • Thanks 1
Link to comment
Share on other sites

You could just forgo the need to add another entry into the DB table and just store your images in a folder e.g: cars/ with unique names that correlate to something already in the DB e.g CA_id ( presuming here ) then link the image as cars/{ID}.jpg 

Link to comment
Share on other sites

1 hour ago, Djkanna said:

You could just forgo the need to add another entry into the DB table and just store your images in a folder e.g: cars/ with unique names that correlate to something already in the DB e.g CA_id ( presuming here ) then link the image as cars/{ID}.jpg 

yes this also works if you don't want to use another entry 

  • Like 1
Link to comment
Share on other sites

Great attempt and interesting approach to things.

However, I strongly recommend that you use the framework readily available to make any additions like this; not only is it "the proper way" (debate in a different topic if you wish), but it usually eases future maintenance

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...