Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Change the image path


Ken44

Recommended Posts

Hi.

 

I know just what I what to do but once again my lack of PHP has left me stuck. :'(

 

I have a lot of images so I have uploaded them in low and high resolution to

 

images/manufacturer_name/small/picture_name.jpg

and

images/manufacturer_name/large/picture_name.jpg

 

I have got all the small images working just fine.

 

What I want to do is point popup_image.php to the larger picture

 

I don't even need to check 'if large image exists' because I know they do. All I need is to change the word 'small' to 'large'. (But the check would do no harm)

 

manufacturer_name changes with product_name

picture_name.jpg changes with product_name

 

 

I found this thread which comes close but does not do exactly the same

http://www.oscommerce.com/forums/index.php?sho...c=28691&hl=

 

 

I wondered if a PHP Guru would be good enough to help. Please don't suggest a contrib. for this. I am sure I don't need a contribution just to change the path of the image

 

Thanks.

 

Ken.

Link to comment
Share on other sites

There's a little more to it than just changing one word.

 

I'm no "PHP Guru" (as you put it) but I'll see what I can do.

 

It'll be tomorrow evening at the earliest before I might have something.

 

Maybe someone else will have a solution before then.

:)

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Hi Remy.

 

Thanks. I had a good look at all the image contributions before posting this thread. Most (inc your suggestion) are to give the option of multiple images. Others are to make the thumbnail from the larger image and most of them alter the database structure. I am trying to avoid over complicating things and want to keep the osC code as simple as possible.

 

 

 

Hi Jim.

 

I guess this is the line that need changing

 

echo tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name']);

 

And I found this at php.net

mixed str_replace ( mixed $search, mixed $replace, mixed $subject [, int &$count] )

This function returns a string or an array with all occurrences of search in subject replaced with the given replace value.

 

Am I on the right track?

 

Would it be easier if I kept the images in the same location?

Eg

images/manufacturer_name/picture_name_small.jpg

and

images/manufacturer_name/picture_name_large.jpg

 

 

If that would be easier I would be happy to change my images.

 

I also found this

 

http://www.oscommerce.com/forums/lofiversion/i...hp?t238909.html

 

This code appears to replace a imagea (small image) with a imageb (large image)

So I think I could amend this code if I changed my picture names as above

 

Ken.

Link to comment
Share on other sites

Hi.

 

I know just what I what to do but once again my lack of PHP has left me stuck. :'(

 

I have a lot of images so I have uploaded them in low and high resolution to

 

images/manufacturer_name/small/picture_name.jpg

and

images/manufacturer_name/large/picture_name.jpg

 

What I want to do is point popup_image.php to the larger picture

 

Thanks.

 

Ken.

 

I needed the solution to the same problem Ken.

 

I too tried getting an easy editing fix, but... nada.

 

Take a look at these contributions, I think they are just what you are looking for. ;)

 

oscFileBrowser v1.0.0

- or -

Image Subdirectories 2.0

- and -

Big Images v1.25

 

I know you said you didn't want to use contributions and wanted to keep your install simple. If you don't get an answer as to how too edit your code easily, take a look at the above contributions. They really are a big help!

 

Good luck :thumbsup:

- :: Jim :: -

- My Toolbox ~ Adobe Web Bundle, XAMPP & WinMerge | Install ~ osC v2.3.3.4 -

Link to comment
Share on other sites

There's more to this than meets the eye Ken.

 

I'd rather see you use a contribution, if it looks like it would fulfill your needs.

 

We can't be sure of the effect "custom coding" would have on you in the future.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Hi Jim

 

I am beginning to realise why these contributions are so complicated. One reason is so that images can be imported through admin, but I do not need that.

 

I have written code (VB) to extract prices,descriptions etc from my accounts program and other sources. My code creates the csv files which I can then import straight into my osc sql database this also allows me to add the manufacturer_name to the image path.

 

All I then need to do is make sure that all my images are uploaded to the correct /image/manufacturer_name/ location.

 

All this code is written and working OK. (I guess it's very similar to what can be done with easy populate.)

 

I modified the code mentioned above and got it working

 

Here is the method

 

1) Backup, Backup

 

2) Create a low and a high resolution image for each product

Call the images image_name_small.jpg and image_name_large.jpg

The important bit is the small and large at the end

 

3) Open catalog/popup_image.php

 

4) Change

echo tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name']);

To

$product_substr = $products['products_image'];

$product_substr = substr($product_substr,0, strlen($product_substr) - 9) . "large.jpg";

echo tep_image(DIR_WS_IMAGES . $product_substr, $products['products_name']);

 

5) save popup_image.php

 

Examples

http://www.cameracentre.co.uk/product_info...products_id=430

http://www.cameracentre.co.uk/product_info...products_id=115

 

(click 'click to enlarge')

 

This works because 'small' and 'large' both contain 5 characters.

 

Jim, I hear what you are saying and I realise that this method is not for everyone but this seems much simpler for my needs. I have UK-based and paypal IPN contributions installed and I really don't think I will install any more.

Can you see any problems with this?

 

Now, if I could only get the popup window to open to a locked 600 x 600 window?

 

(I have made all my images square, it seemed like the easiest solution)

 

Ken.

Link to comment
Share on other sites

I clicked both of those links, and they enlarged to a much bigger size.

 

Way to go!

:thumbsup:

 

Does that mean this is solved, or do you need to do more?

:unsure:

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Does that mean this is solved, or do you need to do more?

 

I am happy with this method, so this is now done. Paypal next. :sweating:

 

Thanks again

 

Ken.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...