Jump to content
Sign in to follow this  
killerwhale65

photo gallery for oscommerce

Recommended Posts

this change allows to sort and see last uploaded image on the top of catalog/gallery.php

 

in this file replace line 80 to

  $gallery_query_raw ="select id, cID, pID, comment, title, description from ". TABLE_GALLERY ." order by pID desc";

Share this post


Link to post
Share on other sites
for those of you having the login redirect problem try to change the form constructor for uploading images located in gallery_user.php from:

 

<form enctype="multipart/form-data" action="gallery_user.php" method="POST">

 

to:

<?php echo tep_draw_form('fotouploaden', 'gallery_user.php?osCsid=' . $osCsid  ,'post', 'enctype="multipart/form-data"');?>

 

In my RC1 with image_gallery08 this change stoped image upload, it just redirect to index.php with no upload and no errors.

So I back with greate pleasure to

<form enctype="multipart/form-data" action="gallery_user.php" method="POST">

 

Also to solve problem with utf-8 in catalog/gallery_process.php you need to set a proper encoding for the page

after

require('includes/application_top.php');

add

header('Content-type: text/html; charset=UTF-8');

or any charset what match your DB table collation

Edited by leveera

Share this post


Link to post
Share on other sites

I am having an issue using the slideshow gallery.php box. It is randomly generating most of the pictures but occasionally displays on red x for a picture. Any idea why this is happening?

Share this post


Link to post
Share on other sites

This plagued me since I rewrote the contrib. It was an easy fix. The slideshow is trying to display an image of a 2nd thumbnail directory in the thumbnail directory. You need both thumbnail dirs, they hold different size gallery thumbs. The fix is:

 

in catalog/includes/boxes/gallery.php:

***FIND:

$pictures = scandir($dir);

 

***REPLACE WITH:

$pictures = array_diff(scandir($dir), array('.', '..', '.DS_Store','thumbnails'));

 

I am putting an update together and will post it soon. I am also going to limit the number of thumbs loaded for the slideshow so the box doesn't load every picture every time. I think 25 random pics should be enough.

 

 

lildog

 

I am having an issue using the slideshow gallery.php box. It is randomly generating most of the pictures but occasionally displays on red x for a picture. Any idea why this is happening?

Share this post


Link to post
Share on other sites

laveera,

 

To change the height and width parameters:

 

in gallery_user.php

 

***FIND:

if ($width>800){die("width is too large");}

if ($height>600){die("height is too large");}

 

**CHANGE: 800 and 600 to what ever you like.

 

Thank you for all of your suggestions, I am adding them into a new version and will upload it soon.

 

lildog

 

Is any way to permit upload vertical 800px (height) x 600 px images?

 

Also have to report what first try to upload by admin/gallery_upload.php forward to admin login page, after loging upload goes normaly.

Share this post


Link to post
Share on other sites

This should be more universal:

 

header('Content-type: text/html; charset=' . CHARSET . '');

 

CHARSET is set in includes/languages/YOUR LANGUAGE.php

 

In my RC1 with image_gallery08 this change stoped image upload, it just redirect to index.php with no upload and no errors.

So I back with greate pleasure to

<form enctype="multipart/form-data" action="gallery_user.php" method="POST">

 

Also to solve problem with utf-8 in catalog/gallery_process.php you need to set a proper encoding for the page

after

require('includes/application_top.php');

add

header('Content-type: text/html; charset=UTF-8');

or any charset what match your DB table collation

Share this post


Link to post
Share on other sites

Uploaded a new version. Thanks to Laveera for many of the fixes.

 

lildog

Share this post


Link to post
Share on other sites

I may have missed it, but was there an update released that allows you to specify a max number of photos per page? Right now they all load on a single page, which takes a while. Thanks!

Share this post


Link to post
Share on other sites

I don't remember which one but .07,.08 the galleries are paginated and you can set the max per page in the admin.

 

lildog

 

I may have missed it, but was there an update released that allows you to specify a max number of photos per page? Right now they all load on a single page, which takes a while. Thanks!

Share this post


Link to post
Share on other sites

thanks for upload photo_gallery09

 

meanwhile some problems to fix

 

includes/boxes/gallery.php

 

line 43 ... why FILENAME_SPECIALS ???

	new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_SPECIALS));

 

scandir function is available only from php5

for alll who is under php4 it will breake the box

here is a fix, just add on the top before

$dir = './gallery/thumbnails/';

// for PHP 4 versions
if (PHP_VERSION < 5) {
function scandir($dir) {
$dh = opendir($dir);
while (false !== ($filename = readdir($dh))) {
$files[] = $filename;
}
sort($files);
return $files;
}
}

 

last one.

How to fix the box height?

It vary now its vertical size in depends of picture format

Share this post


Link to post
Share on other sites

I am very happy with this contribition and upgraded it to version 0.9 (from 0.5) in my testing environment.

I run into one problem: when i try to upload a picture (while I am logged in), i get the login page after pressing the upload button.

 

This happens both as user in the shop as admin in the admin-area. Where shoul I look first?

 

Test-environment:

Server with XAMPP 1.7.0 for Windows

PC with XP and IE7

both on local LAN

 

Greetings,

 

Arnold

Share this post


Link to post
Share on other sites

Excellent Contribution.

 

I just finished porting it over to CRE Loaded 6.2.13.HT - The HT stands for my version, which is highly customized with a lot more features and a ton less bugs.

 

I added an Admin approval and rejection process, Once it's approved, the customer can no longer modify anything about the graphic, but they can delete it.

 

I also cleaned up a bunch of issues with URL hacking that can occur - If I'm not mistaken, I think any user can delete any other users photo or modify other users photos by changing the cID on the URL.

 

I really can't donate my changes, since it's been CRE-Converted.

 

But, I just had to give a shout out! Very good contribution, much appreciated.


Check out my Community Profile (Click Here)

 

Share this post


Link to post
Share on other sites

Hi Folks,

 

just installed the wonderful contrib...but nit able to keep it running

 

When i upload from frontend always error...

 

when i upload from admin:

 

 

Warning: copy(/kunden/XXX/webseiten/catalog/gallery/13_1.jpg) [function.copy]: failed to open stream: No such file or directory in /kunden/XXX/webseiten/catalog/admin/gallery_upload.php on line 57

 

Warning: Cannot modify header information - headers already sent by (output started at /kunden/XXX/webseiten/catalog/admin/gallery_upload.php:57) in /kunden/XXX/webseiten/catalog/admin/includes/functions/general.php on line 46

 

can anyone fix that?

 

regards

Thomas

Share this post


Link to post
Share on other sites

I am receiving a couple errors on my installation perhaps someone can assist.

 

#1 - I receive the following error on my gallery_upload.php page, after entering the debug line suggested by the developer of this contribution. my gallery folder is 666

 

FOR TESTING ONLY/tmp/phpdWRUvc

/catalog/gallery/

Warning: copy(/catalog/gallery/2_1.jpg) [function.copy]: failed to open stream: No such file or directory in /home/xxx/public_html/catalog/admin/gallery_upload.php on line 58

 

Warning: Cannot modify header information - headers already sent by (output started at /home/xxx/public_html/catalog/admin/gallery_upload.php:55) in /home/xxx/public_html/catalog/admin/includes/functions/general.php on line 54

 

#2 - I receive the following error on my webpages in the left hand menu

 

Warning: array_rand() [function.array-rand]: Second argument has to be between 1 and the number of elements in the array in /home/xxx/public_html/cart/includes/boxes/gallery.php on line 20

Share this post


Link to post
Share on other sites

Hi again....

 

thats the same error as it was here....

 

ok....solved that

 

First error is because the file cannot be stored...- solution: make directory catalog/gallery/ and makre it writetable.... then it works and files can be stored

 

second error only is because of first error...

 

 

the other thing i dont have because i dont use the gallery-box

 

regards

Thomas

Share this post


Link to post
Share on other sites

Ahhh, box height. I wasn't able to overcome that. I will revisit it and see if I can fix it. Right with the scandir! I will revert it, I made the change and it worked well, it was a suggestion here. I really do want it to be retro friendly. Specials because that is the original box I had used as a template. My customer used graphical headers for her boxes and I just uncommented the line. I hope you figured it out, there needs to be an extra define somewhere. It is getting late here, I will fix and update in the morning.

 

Thanks for pointing out those problems.

 

lildog

 

 

thanks for upload photo_gallery09

 

meanwhile some problems to fix

 

includes/boxes/gallery.php

 

line 43 ... why FILENAME_SPECIALS ???

	new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_SPECIALS));

 

scandir function is available only from php5

for alll who is under php4 it will breake the box

here is a fix, just add on the top before

$dir = './gallery/thumbnails/';

// for PHP 4 versions
if (PHP_VERSION < 5) {
function scandir($dir) {
$dh = opendir($dir);
while (false !== ($filename = readdir($dh))) {
$files[] = $filename;
}
sort($files);
return $files;
}
}

 

last one.

How to fix the box height?

It vary now its vertical size in depends of picture format

Share this post


Link to post
Share on other sites

Sounds like you made some great changes. Send me your changes and I will try to work them in to the contrib here. If not just changes send whatever code you've got. Every little bit helps.

 

lildog

 

Excellent Contribution.

 

I just finished porting it over to CRE Loaded 6.2.13.HT - The HT stands for my version, which is highly customized with a lot more features and a ton less bugs.

 

I added an Admin approval and rejection process, Once it's approved, the customer can no longer modify anything about the graphic, but they can delete it.

 

I also cleaned up a bunch of issues with URL hacking that can occur - If I'm not mistaken, I think any user can delete any other users photo or modify other users photos by changing the cID on the URL.

 

I really can't donate my changes, since it's been CRE-Converted.

 

But, I just had to give a shout out! Very good contribution, much appreciated.

Share this post


Link to post
Share on other sites

The: Warning: Cannot modify header information - headers already sent by (output started at /kunden/XXX/webseiten/catalog/admin/gallery_upload.php:57) in /kunden/XXX/webseiten/catalog/admin/includes/functions/general.php on line 46

 

error is USUALLY caused by carriage returns or line feeds or spaces after the final ?> on one of the pages being used. Probably in general.php but could be any included files.

 

Do you have a gallery folder with write permisions in /catalog?

 

lildog

 

Hi Folks,

 

just installed the wonderful contrib...but nit able to keep it running

 

When i upload from frontend always error...

 

when i upload from admin:

 

 

Warning: copy(/kunden/XXX/webseiten/catalog/gallery/13_1.jpg) [function.copy]: failed to open stream: No such file or directory in /kunden/XXX/webseiten/catalog/admin/gallery_upload.php on line 57

 

Warning: Cannot modify header information - headers already sent by (output started at /kunden/XXX/webseiten/catalog/admin/gallery_upload.php:57) in /kunden/XXX/webseiten/catalog/admin/includes/functions/general.php on line 46

 

can anyone fix that?

 

regards

Thomas

Share this post


Link to post
Share on other sites

Sorry about that...looks like you got it fixed yourself. Good job...

 

lildog

 

The: Warning: Cannot modify header information - headers already sent by (output started at /kunden/XXX/webseiten/catalog/admin/gallery_upload.php:57) in /kunden/XXX/webseiten/catalog/admin/includes/functions/general.php on line 46

 

error is USUALLY caused by carriage returns or line feeds or spaces after the final ?> on one of the pages being used. Probably in general.php but could be any included files.

 

Do you have a gallery folder with write permisions in /catalog?

 

lildog

Share this post


Link to post
Share on other sites

laveera,

can you confirm the problem maatwerk is having? Having to log in even if you are logged in? I am going to assume it is an osc session id problem. I will check it out.

 

lildog

Share this post


Link to post
Share on other sites
#2 - I receive the following error on my webpages in the left hand menu

 

Warning: array_rand() [function.array-rand]: Second argument has to be between 1 and the number of elements in the array in /home/xxx/public_html/cart/includes/boxes/gallery.php on line 20

 

It's because the function has been hardcoded to a figure of 25 and unless you have 25 or more images in the gallery it will give this error

 

change in /includes/boxes/gallery.php

 

 $rand_keys=array_rand($pictures,25);

 

to this

 

  $rand_keys=array_rand($pictures,count($pictures));

 

And that will fix the error

Share this post


Link to post
Share on other sites

No, I have no problems at all now with the contribution (except the box height)

 

I think it may be a reason of some added mods or local server settings. May be resonable to give in Install.txt a two ways for gallery_user.php

<form enctype="multipart/form-data" action="gallery_user.php" method="POST">

or

<?php echo tep_draw_form('fotouploaden', 'gallery_user.php?osCsid=' . $osCsid  ,'post', 'enctype="multipart/form-data"');?>

 

 

laveera,

can you confirm the problem maatwerk is having? Having to log in even if you are logged in? I am going to assume it is an osc session id problem. I will check it out.

 

lildog

Share this post


Link to post
Share on other sites

In gallery.php if you have installed your shop to a seperate directtion ie /catalog/

 

Then all the java script calls are wrong

 

For example line 25

 

<script type="text/javascript" src="<?php echo HTTP_SERVER ?>/highslide/highslide.js"></script>

 

needs to be

 

<script type="text/javascript" src="highslide/highslide.js"></script>

 

And in the style parts (these really need taking out from this files and adding to the main stylesheet

 

You need to remove all the

?php echo HTTP_SERVER ?>

as well to correct this error.

 

You also need to add after this line

echo '<input type="text" name="comment_naam" value="'.TEXT_NAME.'" onClick="this.value=\'\'">';

 

this

 

echo '<input type="hidden" name="osCsid" value="'. $_GET['osCsid'].'">';

 

To prevent the logging out errors

 

The same fix is also needed in gallery_user.php

Share this post


Link to post
Share on other sites

Just had a look at this addon and its great

 

Wondering however if anyone has set it up to use lightbox instead of highslide?

 

i use lightbox on the rest of the site with morepics 6 and would like to keep everything uniform

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×