Jump to content

manipulate a string


KillerBeeZ

Recommended Posts

is there a function to take a part of a string and add to it?

 

for example, in my database I have the addresses stored for several images. I'm making a racing game that shows these images for the cars while racing. The problem is resizing the images in html only shrinks the physical dimensions but the image still takes the same amount of space, like 200k or something depending on the image. I have thumbnails for all of the images and the name of the file is exactly the same as the original except with a TN- added to the front of the file name. I could add that fairly easily except that the folders are different for the images So, what I'd like to do is to add a TN- in the middle of a string.

 

<div align=\"center\"><img src=\"$car1image[0]\" height=\"50\"></div>

 

$car1image[0] = "http://www.ctlinx.com/piwigo/upload/2012/05/24/20120524171350684011fb.jpg"

 

will need to be changed to

 

$car1image[0] = "http://www.ctlinx.com/piwigo/upload/2012/05/24/TN-20120524171350684011fb.jpg"

 

(these addresses are not static, they are dynamic, I made them static here as an example)

 

Is this possible? Is there a better way to resize images on the fly? or do I have to add all the thumbnails to the database too (keeping in mind there are at present over 3000 images and that's just Dodge, Chevy and a few Audi's)?

Link to comment
Share on other sites

thank you so much, that was perfect and you my friend are a genius with php :)

 

oh and Freelance, the path and file name are all saved as one big string in sql as the people entering in the data upload the image, then just copy the path in their browsers address bar to enter into the database.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

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.