Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

SSL images solution


Guest

Recommended Posts

Hi all,

I think the only way to finish with the annoying non secure messages is keep a copy of all products images into ssl folder and set the images path to there when in ssl mode (I know is a stupid solution but... :oops: ).

So I need to duplicate the upload code at admin/catalog.php with the ssl path but the second upload didn't work.

Here the code, maybe I did some wrong:

 

// copy image only if modified

       $products_image = new upload('products_image');

 

       $products_image->set_destination(DIR_FS_CATALOG_IMAGES);

       if ($products_image->parse() && $products_image->save()) {

         $products_image_name = $products_image->filename;

       } else {

         $products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : '');

       }

// copy image to https

// DIR_FS_CATALOG_IMAGES_HTTPS was set at configure.php



       $products_image2 = new upload('products_image');

       $products_image2->set_destination(DIR_FS_CATALOG_IMAGES_HTTPS);

        if ($products_image2->parse() && $products_image2->save()) {

          $products_image_name2 = $products_image2->filename;

        } else {

          $products_image_name2 = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : '');

        }

 

Any help?

Cheers

Link to comment
Share on other sites

Are both folders on the same server? If so, it would be simpler to have your host link the https images directory to the http image directory.

 

Btw, I don't think you can move the uploaded image twice. It might be easier to write this as

// copy image only if modified

       $products_image = new upload('products_image');

     

       $products_image->set_destination(DIR_FS_CATALOG_IMAGES);

       if ($products_image->parse() && $products_image->save() && copy(DIR_FS_CATALOG_IMAGES . $products_image->filename, DIR_FS_CATALOG_IMAGES_HTTPS)) {

         $products_image_name = $products_image->filename;

       } else {

         $products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : '');

       }

I'm not sure that I understand the purpose of $products_image_name2.

 

Hth,

Matt

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...