Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Dynamic MoPics


dreamscape

Recommended Posts

this also depends on how your main pic is defined in admin.

 

it appears you have it just as stalker.jpg (looks in images/stalker.jpg)... so you need that false...

 

also:

stalker.jpg

stalker_pic2.jpg

stalker_pic3.jpg

 

where is stalker_pic1.jpg???

 

the module looks for stalker_pic1.jpg first to even decide if it need to run...

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 244
  • Created
  • Last Reply

Top Posters In This Topic

tep_snapshot-20030613

http://www.directplastics.com/ - login osc/osc

 

Hi

 

I've spent a few hours trying to get Dynamic MoPics working without success.

 

I'm getting 'coming soon!', although the original osC code is working and using the 'big pics'.

 

File Structure

images - contains thumb size images

images/products_big - contains big images

images/products_thumbs - contains thumb size images

 

Code

 

// Dynamic MoPics

define('IN_IMAGE_BIGIMAGES','products_big/'); //directory inside catalog/images where your big images are stored

define('IN_IMAGE_THUMBS', 'products_thumbs/'); //directory inside catalog/images where you mopic thumbs are stored..

define('MAIN_THUMB_IN_SUBDIR', false); //if you store your main thumb in the above directory set this true. if its in the main image dir, set it false

define('THUMBS_PER_ROW', '4');

define('MORE_PICS_EXT', '');

define('BIG_PIC_EXT', ''); // this is if you name your big thumb like IMAGE_big.jpg, you would put '_big' here. otherwise leave it blank

define('THUMB_IMAGE_TYPE', 'jpg'); //the extention for the extra thumbnail images (jpg, gif, bmp, png, etc...)

define('BIG_IMAGE_TYPE', 'jpg'); //the extention for your big images (jpg, gif, bmp, png, etc...)

?>

 

 

If I set define('MAIN_THUMB_IN_SUBDIR', true); the pop up does not contain an image.

 

I'm wondering if Dynamic MoPics doesn't like the cart being installed in root as I have done?

 

If someone could take a look and see if I'm doing something obviously wrong I'd be grateful.

 

Thanks.

David @ 1cog.

Link to comment
Share on other sites

  • 3 weeks later...

After many hours reading this thread and the instructions I still could not get Dynamic MoPics working. The thumb displayed in product_info but clicking on it produced an empty window.

 

I eventually got it working by setting 'Image Required' to 'True' instead of 'False' in Admin. However, this isn't a solution for me because the catalog contains almost 1,000 products, many of which do not have images and some never will... so I don't want the shop covered with broken images.

 

However, I still think there's something wrong with my installation of Dynamic MoPics:

 

E.g. http://www.directplastics.com/product_info...products_id=880

 

  define('IN_IMAGE_BIGIMAGES','products_big/'); //directory inside catalog/images where your big images are stored

 define('IN_IMAGE_THUMBS', 'products_small/'); //directory inside catalog/images where your mopic thumbs are stored

 define('MAIN_THUMB_IN_SUBDIR', false); //if you store your main thumb in the above directory set this true.  if its in the main image dir, set it false

 define('THUMBS_PER_ROW', '4');

 define('MORE_PICS_EXT', '_pic');

 define('BIG_PIC_EXT', ''); // this is if you name your big thumb like IMAGE_big.jpg, you would put '_big' here.  otherwise leave it blank

 define('THUMB_IMAGE_TYPE', 'jpg'); //the extention for the extra thumbnail images (jpg, gif, bmp, png, etc...)

 define('BIG_IMAGE_TYPE', 'jpg'); //the extention for your big images (jpg, gif, bmp, png, etc...)

 

Even though MAIN_THUMB_IN_SUBDIR is set to false, the thumb is displayed from /images/products_small/aaa_pic1.jpg. This isn't correct is it? It should be /images/aaa.jpg?

 

Clicking on the thumb displays a blank window - as mentioned above I can make it work by setting 'Image Required' to 'True', but that is not an option for me.

 

If someone could help out this time - especially Joshua - I'd very grateful.

 

Thanks.

David @ 1cog.

Link to comment
Share on other sites

After a lot of wasted effort I never got this to work the way it is supposed to. I dont know if it is a programming bug, or somthing I just missed. Either way, I found a better way to accomplish my goal.

 

I installed the normal mo pics, and modified the EZpopulate to work with it. Now I justput the file name in easy populate, upload all the pics via FTP, and there they are on the product info page.

 

I'm not trying to belittle the author of dynamic, but I just found it easier for me to do it this way.

Link to comment
Share on other sites

Thanks, James. I'll use that as a fallback, although it might be quite a bit of work to integrate that in to my modified categories.php, product_info.php, etc.

 

I'd really like to get Dynamic MoPics working because it's easier for the store owner to add new products / images. It's working for other people so there must be an answer??? It's either my installtion of osC (snapshot 20030623 - all bug fixes applied to date) or I've screwed something up installing this mod.

 

Hopefully someone has an answer.

David @ 1cog.

Link to comment
Share on other sites

Just a quick look at your site urls shows that the thumb is coming from

 

http://www.directplastics.com/images/produ...ll/aaa_pic1.jpg

 

and the big pic is coming from

http://www.directplastics.com/images/produ...ig/aaa_pic1.jpg

 

How are you naming your pictures? They should be

 

images/aaa_pic.jpg (main thumb)

products_small/aaa_pic1.jpg (other thumbs)

products_small/aaa_pic2.jpg

products_small/aaa_pic3.jpg ... etc

 

products_big/aaa_pic.jpg

products_big/aaa_pic1.jpg

products_big/aaa_pic2.jpg

products_big/aaa_pic3.jpg

 

I think there's a bug in the code if you set

 

define('MAIN_THUMB_IN_SUBDIR', true);

 

but I haven't had the time or inclination to check it out and fix it. So don't use true (I see you're not so it's not a problem).

 

Hope this helps. It took me a while to figure it out as well.

 

-al

Link to comment
Share on other sites

Hi

 

Just a quick look at your site urls shows that the thumb is coming from

 

http://www.directplastics.com/images/produ...ll/aaa_pic1.jpg

 

Yeah, that's right - but I've set MAIN_THUMB_IN_SUBDIR to false so it shouldn't be using 'products_small' and I don't know why it requires the _pic1' extension. I don't need extra images - just a thumbnail and a big image - the same as:

 

http://www.playgroundforthemind.com/catalo...&products_id=41

 

and

 

http://www.madmacgames.com/mac_game.php?na...&products_id=72

 

It works for them so there's gotta be a way. All I need is to have

 

images/aaa.jpg - thumbnail image

images/products_big/aaa.jpg - big image

 

Easy? :?

David @ 1cog.

Link to comment
Share on other sites

Sorry, I didn't read your declarations very closely.

 

You're right, you don't need the '_pic' extension on your main thumb.

 

Unfortunately I can't think of any reason this is happening for your site - I gather you haven't modified the dynamic mopics code at all?

 

Sorry I can't be more of a help... You might want to PM dreamscape and see if he has any suggestions.

 

Good luck!

 

-al

Link to comment
Share on other sites

Hi

 

Just a quick look at your site urls shows that the thumb is coming from

 

http://www.directplastics.com/images/produ...ll/aaa_pic1.jpg

 

Yeah, that's right - but I've set MAIN_THUMB_IN_SUBDIR to false so it shouldn't be using 'products_small' and I don't know why it requires the _pic1' extension. I don't need extra images - just a thumbnail and a big image - the same as:

 

http://www.playgroundforthemind.com/catalo...&products_id=41

 

and

 

http://www.madmacgames.com/mac_game.php?na...&products_id=72

 

It works for them so there's gotta be a way. All I need is to have

 

images/aaa.jpg - thumbnail image

images/products_big/aaa.jpg - big image

 

Easy? :?

 

David, the dynamic moPICS will work for just a thumbnail & big image. In this case, you would not be using the module/dynamic_mopics.php file. All you need is the configuration & popup_image.php. The products main thumbnail is set from admin, so if the main thumb being called is "images/products_small/aaa_pic1.jpg", then you must have set it to that in admin. The Dynamic moPICS has nothing at all to do with the main thumbnail. As always that is controlled by the OSC admin. the Dynamic moPICS popup_image.php does provide support for a big image of the main thumbnail.

 

so if you want you main thumb to be "images/aaa.jpg", then you have to set the main thumb for that product in admin to be "aaa.jpg" (products_image). As it is, you have it set to "products_small/aaa_pic1.jpg" for some reason.

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Link to comment
Share on other sites

Hi Joshua

 

This is what is puzzling me - I have set the main thumb to be aaa.jpg in Admin (confirmed by looking at products_image in the database), but when I look at the image source for the thumbnail displayed in product_info it shows /images/products_small/aaa_pic1.jpg. However, the preview in Admin shows /images/aaa.jpg.

 

This is a problem with Dynamic MoPics or the way I've installed it (done it three times now!)???

David @ 1cog.

Link to comment
Share on other sites

David it seems what you have done, it replaced the main thumb code with the dynamic mopics code...

 

that isn't how the module is to be used...

 

The main thumb code isn't to be changed, and the include('dynamic_mopics.php'); is to be placed where you want the OTHER images to show up.

 

I think you have replaced the OSC code that shows the main thumb with the dynamic mopics. that is incorrect and not how the module was made to work. the mopics module shows extra pics besides the main thumb. it doesn't show the main thumb. The default code in OSC does that well on its own. :wink:

 

I think this must be your problem. No way the default OSC main thumb code could be calling that image. and that image (aaa_pic1.jpg) is the 1st image that the dynamic mopics module would look for to display the EXTRA images.

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Link to comment
Share on other sites

That's exactly what I did. I wonder if the installation instructions should be expanded to explain that the MOPICS function does not replace the osC one?

 

OK, progress. So now the thumb is displayed as /images/aaa.jpg.

 

However, when I click on the thumb the enlarge window is blank - unless I set 'Image Required' to 'true' in Admin (as mentioned before this isn't an option for me because I don't want broken images displayed for products that do not have images associated with them). With 'Image Required' set to true it works as expected and displays /images/products_big/aaa.jpg

 

If this problem related to MoPics or is it an osC problem?

David @ 1cog.

Link to comment
Share on other sites

hmm thats odd... the popup_image.php I put not restrictions on IMAGE_REQUIRED.

 

could you post what your code for popup_image.php looks like?

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Link to comment
Share on other sites

It should be the standard code distributed with your mod. Here you go:

 

<?php

/*

 $Id: popup_image.php,v 1.16 2003/02/13 03:10:56 hpdl Exp $



 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright (c) 2003 osCommerce



 Released under the GNU General Public License

*/



 require('includes/application_top.php');



 $navigation->remove_current_page();



 $products_query = tep_db_query("select pd.products_name, p.products_image from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id where p.products_status = '1' and p.products_id = '" . $HTTP_GET_VARS['pID'] . "' and pd.language_id = '" . $languages_id . "'");

 $products_values = tep_db_fetch_array($products_query);

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<title><?php echo $products_values['products_name']; ?></title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<script language="javascript"><!--

var i=0;

function resize() {

 if (navigator.appName == 'Netscape') i=10;

 if (document.images[0]) window.resizeTo(document.images[0].width +30, document.images[0].height+60-i);

 self.focus();

}

//--></script>

</head>

<body onload="resize();">

<div align="center">

<a href="javascript:;" onclick="javascript:top.window.close();">

<?php

if (MAIN_THUMB_IN_SUBDIR == true) {

$thumb_len = strlen(IN_IMAGE_THUMBS);

$thumbs = IN_IMAGE_THUMBS;

} else {

$thumb_len = 0;

$thumbs = '';

}



$image_base = substr($products_values['products_image'], $thumb_len, -4);

// $image_ext = substr($products_values['products_image'], -4);

$image_ext = '.'.BIG_IMAGE_TYPE;

$image_path = DIR_WS_IMAGES . IN_IMAGE_BIGIMAGES;



if (!$HTTP_GET_VARS['pic']) {

$image_addon = BIG_PIC_EXT;

} else {

$image_addon = MORE_PICS_EXT.$HTTP_GET_VARS['pic'];

}



// if the big image isn't shown uncomment the next line, and check the path:

// maybe you have to remove '/'. or adjust the path, depends on your configuration 

  // echo DIR_FS_CATALOG.'/'.DIR_WS_IMAGES.IN_IMAGE_SUBDIR.$products_values['products_image'];

         if (is_file(DIR_FS_CATALOG . $image_path . $image_base . $image_addon . $image_ext)) {

               $image = $image_path . $image_base . $image_addon . $image_ext;

         }

         else {

    if (!$HTTP_GET_VARS['pic']) {

               $image = DIR_WS_IMAGES . $thumbs . $image_base . $image_ext;

    } else {

               $image = DIR_WS_IMAGES . IN_IMAGE_THUMBS . $image_base . $image_addon . $image_ext;

    }

         }

          echo tep_image($image, $products_values['products_name']);

?>

</a>

</div>

</body>

</html>

<?php require('includes/application_bottom.php'); ?>

David @ 1cog.

Link to comment
Share on other sites

The problem seems to be in the call to tep_image: html_ouput.php has

 

  function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {

   if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {

     return false;

   }

 

So either popup_image.php should be changed to display the image without using tep_image or the code for tep_image needs changing to somehow ignore IMAGE_REQUIRED for the popup.

 

As a side note, setting 'Image Required' in Admin to 'false' has some unexpected / undesirable effects, e.g. the star images for Review rating are not displayed.

David @ 1cog.

Link to comment
Share on other sites

Hi Dreamscape,

 

i still having problems installing the dynamic mopics contrib, till i read this one:

 

The main thumb code isn't to be changed, and the include('dynamic_mopics.php'); is to be placed where you want the OTHER images to show up.

 

I think you have replaced the OSC code that shows the main thumb with the dynamic mopics. that is incorrect and not how the module was made to work. the mopics module shows extra pics besides the main thumb. it doesn't show the main thumb. The default code in OSC does that well on its own. :wink:

.

 

Is it really important for the contrib to work that the original main thumb code resides on the page ?????

 

Hans

Link to comment
Share on other sites

Is it really important for the contrib to work that the original main thumb code resides on the page ?????

 

The main thumb code isn't to be changed, and the include('dynamic_mopics.php'); is to be placed where you want the OTHER images to show up.

 

The contrib will still work (i.e. provide additional pics) with the osC thumb code removed but there's no reason (?) to do that. Let the osC thumb code take care of displaying the standard thumb and Dynamic MoPics will display the large picture + additional pictures if required.

David @ 1cog.

Link to comment
Share on other sites

Okay sounds great but: ..................

 

 

 

changing and changing the config, picnames etc.... but still is NOT working... what is wrong ??? who can help ???

 

config :

 

define('IN_IMAGE_BIGIMAGES','images_big/');

define('IN_IMAGE_THUMBS', 'images_small/');

define('MAIN_THUMB_IN_SUBDIR', true);

define('THUMBS_PER_ROW', '4');

define('MORE_PICS_EXT', '_pic');

define('BIG_PIC_EXT', '_pic');

define('THUMB_IMAGE_TYPE', 'jpg');

define('BIG_IMAGE_TYPE', 'jpg');

 

dirs & files

 

thumbs in

 

/catalog/images/images_small/product1_pic.jpg

/catalog/images/images_small/product1_pic1.jpg

/catalog/images/images_small/product1_pic2.jpg

 

big images in :

 

/catalog/images/images_big/product1_pic.jpg

/catalog/images/images_big/product1_pic1.jpg

/catalog/images/images_big/product1_pic2.jpg

 

 

who will and can help pleaseeeeeeeeeeeee !????????????

 

Hans

Link to comment
Share on other sites

I've worked out a fix to my problems (couple of posts up).

 

To get big pictures working with 'Images Required' set to false I changed the following code in popup_image.php:

 

From:

echo tep_image($image, $products_values['products_name']);

 

To:

echo '<img src=' . $image_path . $image_base . $image_addon . $image_ext .  ' />';

 

Not pretty but it works.

David @ 1cog.

Link to comment
Share on other sites

I still don't see what is going on with the Image Required... the image path is correct and the image does exist, so IMAGES REQUIRED should have no effect on the module.

 

On my snapshot, it doesn't. The popup works with IMAGES REQUIRED set to either one. Which leads me to beleive that the tep_image function is the problem for one reason or another.

 

David, If you get a chance, would you mind looking in catalog/includes/functions/html_output.php and searching for function tep_image and pasting that function over here??

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Link to comment
Share on other sites

Hi Joshua

 

Thanks for confirming that 'Images Required' should not have this effect - that's what I guessed.

 

I thought it was something to do with tep_image, but the function hasn't changed for a long time and my code is identical to the last few releases:

 

My code:

// The HTML image wrapper function

 function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {

   if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {

     return false;

   }

 

Although http://www.directplastics.com/ looks fairly standard I've changed quite a few lines of code, added bug fixes and a few contribs. I've probably screwed something up. :roll:

 

It would be nice to fix this but all the important bits are working so I'm not too worried, but if you can think of any suggestions I'll be happy to hear them.

David @ 1cog.

Link to comment
Share on other sites

Aloha Dreamscape,

I am trying to implement DMP contribution but I keep getting an error code. Could you please tell me what this means?

Warning: move_uploaded_file(/home/shelldav/wwwroot/shelldave.com/ecommerce/catalog/images/thumbs/20a.jpg) [function.move-uploaded-file]: failed to create stream: Permission denied in /home/shelldav/wwwroot/shelldave.com/ecommerce/admin/includes/functions/general.php on line 789



Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpFdabbK' to '/home/shelldav/wwwroot/shelldave.com/ecommerce/catalog/images/thumbs/20a.jpg' in /home/shelldav/wwwroot/shelldave.com/ecommerce/admin/includes/functions/general.php on line 789

 

Much appreciated!

Jenn

Link to comment
Share on other sites

Ok, I'm getting 2 error codes, got this one when trying to click on image for larger popup:

Warning: main(DIR_WS_MODULESFILENAME_DYNAMIC_MOPICS) [function.main]: failed to create stream: No such file or directory in /home/shelldav/wwwroot/shelldave.com/ecommerce/catalog/product_info.php on line 170



Warning: main() [function.main]: Failed opening 'DIR_WS_MODULESFILENAME_DYNAMIC_MOPICS' for inclusion (include_path='') in /home/shelldav/wwwroot/shelldave.com/ecommerce/catalog/product_info.php on line 170

 

I'm sure its something stupid, I'm new at PHP, but I appreciate your time!

Link to comment
Share on other sites

Just a guess without seeing your code...

 

Take a look at line 170 in catalog/product_info.php. It probably looks something like:

 

<?php include('DIR_WS_MODULES' . 'FILENAME_DYNAMIC_MOPICS'); ?>

 

But should be more like:

 

<?php include(DIR_WS_MODULES . FILENAME_DYNAMIC_MOPICS); ?>

 

Notice the missing quotes in the changed line.

 

If this is not the problem post the several lines of code spanning line 170 so folks can take a look at it.

Link to comment
Share on other sites

There weren't any quotes, but here is the code:

<!-- body_text //-->

   <td width="100%" valign="top"><form name="cart_quantity" action="http://shelldave.com/ecommerce/catalog/product_info.php/action/add_product?osCsid=cbddd5d4ec6fda3235574e3c2416fa61" method="post"><input type="hidden" name="osCsid" value="cbddd5d4ec6fda3235574e3c2416fa61" /><table border="0" width="100%" cellspacing="0" cellpadding="0">

     <tr>

       <td class="main"><br>Product not found!</td>

     </tr>



<!-- adding Dynamic MoPics here can be moved around //-->

 <tr>

     <td>

 <?php include(DIR_WS_MODULES . FILENAME_DYNAMIC_MOPICS); ?>

 </td>

     </tr>

<!-- end MoPics //-->



     <tr>

       <td align="right"><br><a href="http://shelldave.com/ecommerce/catalog/default.php?osCsid=cbddd5d4ec6fda3235574e3c2416fa61"><img src="includes/languages/english/images/buttons/button_continue.gif" border="0" alt="Continue" title=" Continue " width="100" height="22"></a></td>

     </tr>

       </td>

     </tr>

   </table></form></td>

<!-- body_text_eof //-->

 

I appreciate your help!

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...