[FIXED] VM 1.1 on Joomla! 1.5 RC2: Picture Thumbs not showing on front end

Started by gorbehnare, September 27, 2007, 19:07:01 PM

Previous topic - Next topic

gorbehnare

I'm new to VM and I had nothing but problems with VM 1.0.12 on Joomla 1.5 RC2, couldn't even install it at all.
VirtueMart 1.1 revision 960 Complete Package installed perfectly with no problems what so ever! This is my first time seeing VM working ever so please bare with me since I don't know much about VM in the first place.
I am using VM with all Cart functionality disabled (plan to use it as a catalog only).

Description:
Two problems:
1. Front end user has to log in to view the shop (Error: You do not have permission to access the requested module)
With this it seems like a lot of people encounter this in many places. I have searched the forum and non of the solutions they have provided has worked for me so far. Seeing that many posts complaining about this means this is a normal behavior probably due to some combination of settings, but it will be nice if there was an easy way to fix this.

2. The thubnails are generated properly and are saved, however they do not show on the front end. (Image not found)
The image URL will be something like:
http://betatest.mhpcomputers.com/components/com_virtuemart/shop_image/product/resized/Athlon_64_3800+_46fb54bb518b6_90x90.jpg

This is what shows up in the front end for the image tag:
<img src="http://betatest.mhpcomputers.com/components/com_virtuemart/show_image_in_imgtag.php?filename=resized%2FAthlon_64_3800%2B_46fb54bb518b6_90x90.jpg&amp;newxsize=90&amp;newysize=90&amp;fileout=" alt="Athlon 64 3800+" border="0" height="90" width="90">

I generally get File does not exist and the image thumb will not show.

VirtueMart Version:
VirtueMart 1.1 revision 960 Complete Package

Joomla/Mambo Version:
Joomla! 1.5 RC2

Steps to replicate:
I have the Auto Genrate Thumbs enabled in configuration, and when I create the product I just upload the image (which is uploaded correctly) and check to automatically generate the Thumb (which generates currectly as well), and that's it...
Is there somthing I'm doing wrong? Am I missing something here?

System Info:
PHP Built on:       Linux cgi0802.int.bizland.net 2.6.19.2-grsec #1 SMP Mon Feb 5 18:45:14 EST 2007 i686
Database Version:    5.0.45-log
Database Collation:    utf8_general_ci
PHP Version:    5.2.1
Web Server:    Apache
Web Server to PHP interface:    cgi
Joomla! Version:    Joomla! 1.5.0 Production/Stable [ Endeleo ] 1-September-2007 15:00 GMT
User Agent:    Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.5) Gecko/20070717 SUSE/2.0.0.5-4.1 Firefox/2.0.0.5

gorbehnare

WORKAROUND:

The Dynamic Thumb Image resizing that can be set in admin configuration does not work. If you disable this option and ensure you always have the right thumb sizes then everything works.

So the bug is with the Dynamic Thumbnail Image Resizing Option

I still Haven't fixed that Permission error thou. Please help. It has got to do with one of these settings also...

No visitors can see the store at the time, but if you log in everything works. Any suggestions on where to begin looking for solutions please?

Scott Carroll

I've got the same issue here.
The thumbnail creation works, the thumbnail is displayed in product admin. It is just not showing up correctly through the store.

Scott Carroll

Got a solution.
In show_img_in_imgtag.php
at line 30:
// Image2Thumbnail - Klasse einbinden
include( CLASSPATH . 'ps_main.php');
include( CLASSPATH . "class.img2thumb.php");

$basefilename = @basename(urldecode($_REQUEST['filename']));
$filename = IMAGEPATH."product/".$basefilename;
$filename2 = IMAGEPATH."product/resized/".$basefilename;
$newxsize = @$_REQUEST['newxsize'];
$newysize = @$_REQUEST['newysize'];
$maxsize = false;
$bgred = 255;
$bggreen = 255;
$bgblue = 255;


both CLASSPATH and IMAGEPATH need to be relative to document root, not site root.
I added:

// Image2Thumbnail - Klasse einbinden
include( "/home/yournamehere/public_html" . CLASSPATH . 'ps_main.php');
include( "/home/yournamehere/public_html" . CLASSPATH . "class.img2thumb.php");

$basefilename = @basename(urldecode($_REQUEST['filename']));
$filename = "/home/yournamehere/public_html" . IMAGEPATH."product/".$basefilename;
$filename2 = "/home/yournamehere/public_html" . IMAGEPATH."product/resized/".$basefilename;
$newxsize = @$_REQUEST['newxsize'];
$newysize = @$_REQUEST['newysize'];
$maxsize = false;
$bgred = 255;
$bggreen = 255;
$bgblue = 255;


And now it works. Not pretty, but it returns functionality. The goal here would be to change the global declaration of these variables to be document root instead of site root.

Scott Carroll

Nevermind all that, I got a fix here for ya'

in /configuration.php

/* Site Settings */
var $offline = '0';
var $offline_message = 'This site is down for maintenance.<br /> Please check back again soon.';
var $sitename = 'Your Site Name';
var $editor = 'tinymce';
var $list_limit = '20';
var $legacy = '0';


Change it to add
var $absolute_path = '/your/path/here';
var $live_site = '';
So it looks like:

/* Site Settings */
var $offline = '0';
var $offline_message = 'This site is down for maintenance.<br /> Please check back again soon.';
var $sitename = 'Your Site Name';
var $editor = 'tinymce';
var $list_limit = '20';
var $legacy = '0';
var $absolute_path = '/your/path/here';
var $live_site = '';


Of course, change /your/path/here to your document root path.
And that fixes the issue, and doesn't seem to cause any other ruckus.

gorbehnare

Thanks for the fix...  ;)  now I got to remember I have a customized configure.php file on joomla! 1.5 when I update stuff  :D

aravot

Quote from: gorbehnare on September 27, 2007, 19:07:01 PM
Two problems:
1. Front end user has to log in to view the shop (Error: You do not have permission to access the requested module)
With this it seems like a lot of people encounter this in many places. I have searched the forum and non of the solutions they have provided has worked for me so far. Seeing that many posts complaining about this means this is a normal behavior probably due to some combination of settings, but it will be nice if there was an easy way to fix this.

Can not replicate.

Quote2. The thubnails are generated properly and are saved, however they do not show on the front end. (Image not found)
The image URL will be something like:
http://betatest.mhpcomputers.com/components/com_virtuemart/shop_image/product/resized/Athlon_64_3800+_46fb54bb518b6_90x90.jpg

Confirmed using Joomla 1.5 r9007 (this must have happened either in latest revision of Joomla or VM cause it was working before)
It works OK in Joomla 1.0.13

gregdev

Regarding the second problem:

I don't recommend editing Joomla's configuration file. VirtueMart needs to be self-contained.

The difficulty here is that show_img_in_imgtag.php is called directly. None of the Joomla! 1.5 framework is loaded. If it were loaded (with the legacy plugin enabled), then the variables we need would be there. As you noticed, only $mosConfig_absolute_path is needed.

You could load the Joomla! 1.5 framework. We do that inside notify.php. But, in that case, we need all of that overhead. But here, we want things to be lightweight.

How about something like this?

define('_VALID_MOS', 1);

// Get the Joomla! configuration file
$config_file = '../../configuration.php';
include_once( $config_file );

if( !isset( $mosConfig_absolute_path ) ) {
// We are in J! 1.5
define( '_JEXEC', 1 );
$mosConfig_absolute_path = dirname( $config_file );
}

include_once("../../administrator/components/com_virtuemart/virtuemart.cfg.php");



Although I don't like using ../.. , it is already being used. Oh well.

What do you think?

Greg

Edit: Just to clarify... The define( '_JEXEC', 1 ); is not necessary now. But it may be needed in the future as we improve compatibility with J! 1.5.

[tr][td]
[/td][td]
www.plainlycode.com[/td][/tr]
[/table]

Scott Carroll

It is working. Good call, although I can't help but feel that there is a cleaner way to do this still. This does work to keep it self contained.


gregdev

Interesting. It works for me on VM 1.1 r961 and Joomla! 1.5 r9059.

Which browser(s)?

Try opening one of those image URLs directly into a new browser window (same session, though). What happens?

Greg

[tr][td]
[/td][td]
www.plainlycode.com[/td][/tr]
[/table]


gorbehnare

How about we just add the server path to the VM settings in the configurations. There is the path for the secure server, why not include the normal one too. The installer should detect that (hopefully) automatically, but there is no harm in user being able to modify the path manually. Right now I'm experiencing more Path related issues with my new installation... there is a slash missing this time. please refer to this post:
http://forum.virtuemart.net/index.php?topic=32238.0


VMit

Same bug with VirtueMart 1.0.12 stable & Joomla 1.11 Patch 03 (UTF-8).

QuoteI'm new to VM and I had nothing but problems with VM 1.0.12

VirtueMart  1.0.12 stable installed perfectly with no problems.

I inserted some products in VM and it forked just fine - big & small pics show up.

But after some time i installed  more products and find out that small pics dont show up and in another installation width and height of picture in separate window set to "" (empty).
I other installation I turned resizing in Configuration to ON and the values become 9 instead of 90. I will find out. And try to apply the fix here to my sites.

BTW there is another bug with resizing is fixed in class.img2thumb.php which in russian forum in a file class.img2thumb(v.1.5.2.1_duch_edition).zip.