Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - rroc

Pages: 1 [2]
16
Mods & Plugins (Releases & Support) / Re: [MOD] multiupload
« on: June 23, 2005, 08:03:24 AM »
Sorry no demo as the gallery is meant for my friends private use, but I'll give you 4 screenshots.

1: before... here the multiupload is clicked
2: multiupload form
3: after the upload, file names are shown, and also all the images. (here I have another mod to show the gallery name as well, but never mind...)
4: here all the images are added to the category also shown in 1.

(I hope you are able to see something, as the 124kb limit I had to downgrade them a bit)

17
Hi,
I thought this should be an easy one... well, I think the following should work... I didn't test it though as I don't need it. :)  So I won't put it to a 'real' MOD directory before someone has tested it and found it working.... Good luck. : )

So this checks which categories are under the given(default=main) category and picks one of them. From that category  it will pick 10 images, which are shown... At least in theory...


As before, backup following:
functions.php
index.php
home.html



Add a new funcktion to functions.php

Code: [Select]
function get_random_cat_random_images($cat_id = 0, $amount_total = 1)
{
global $site_template, $site_db, $site_sess, $config, $lang;
global $cat_cache, $cat_parent_cache, $new_image_cache, $subcat_ids;

$cattable_width = ceil((intval($config['cat_table_width'])) / $config['cat_cells']);
if ((substr($config['cat_table_width'],-1)) == "%")
{
$cattable_width .= "%";
}

if (!isset($cat_parent_cache[$cat_id]))
{
return "";
}

$visible_cat_cache = array();
foreach ($cat_parent_cache[$cat_id] as $key => $val)
{
if (check_permission("auth_viewcat", $val))
{
$visible_cat_cache[$key] = $val;
}
}
if (empty($visible_cat_cache))
{
return "";
}

$total = sizeof($visible_cat_cache);

$count = 0;
$count2 = 0;
srand((float)microtime() * 1000000);
$category_id = array_rand($visible_cat_cache);

$is_new = (isset($new_image_cache[$category_id]) && $new_image_cache[$category_id] > 0) ? 1 : 0;
$num_images = (isset($cat_cache[$category_id]['num_images'])) ? $cat_cache[$category_id]['num_images'] : 0;

$subcat_ids = array();
get_subcat_ids($category_id, $category_id, $cat_parent_cache);

if (isset($subcat_ids[$category_id]))
{
foreach ($subcat_ids[$category_id] as $val)
{
if (isset($new_image_cache[$val]) && $new_image_cache[$val] > 0)
{
$is_new = 1;
}
if (isset($cat_cache[$val]['num_images']))
{
$num_images += $cat_cache[$val]['num_images'];
}
}
}

for($amount=0;$amount<$amount_total;$amount++)
{
if (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0 ||
  defined("SHOW_RANDOM_CAT_IMAGE") && SHOW_RANDOM_CAT_IMAGE == 0)
{
$random_cat_image_file[$amount] = "";
}
else
{
$randimage = get_random_image($category_id, 0, 1);
if((array_search($randimage, $random_cat_image_file)===FALSE /*NULL for PHP version<4.2*/)
{
$random_cat_image_file["random_cat_image_file".$amount] = $randimage;
}
else
{
$amount--;
}
}
   }
$vars = array(
  "cat_id" => $category_id,
  "cat_name" => $cat_cache[$category_id]['cat_name'],
  "cat_description" => $cat_cache[$category_id]['cat_description'],
  "cat_hits" => $cat_cache[$category_id]['cat_hits'],
  "cat_is_new" => $is_new,
  "lang_new" => $lang['new'],
  "sub_cats" => get_subcategories($category_id),
  "cat_url" => $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$category_id),
  "num_images" => $num_images
  );
$vars = array_merge($vars, $random_cat_image_file);

$site_template->register_vars($vars);
$category_random = $site_template->parse_template("category_random");
return $category_random;
}

CREATE a html file
category_random.html, with the desired layout similar to category_bit.html, here for 10 images...
Code: [Select]
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td valign="top">
      {if random_cat_image_file0}
      <a href="{cat_url}"><img src="{random_cat_image_file0}" border="1"></a><br>
      {endif random_cat_image_file0}{if random_cat_image_file1}
      <a href="{cat_url}"><img src="{random_cat_image_file1}" border="1"></a><br>
      {endif random_cat_image_file1}{if random_cat_image_file2}
      <a href="{cat_url}"><img src="{random_cat_image_file2}" border="1"></a><br>
      {endif random_cat_image_file2}{if random_cat_image_file3}
      <a href="{cat_url}"><img src="{random_cat_image_file3}" border="1"></a><br>
      {endif random_cat_image_file3}{if random_cat_image_file4}
      <a href="{cat_url}"><img src="{random_cat_image_file4}" border="1"></a><br>
      {endif random_cat_image_file4}{if random_cat_image_file5}
      <a href="{cat_url}"><img src="{random_cat_image_file5}" border="1"></a><br>
      {endif random_cat_image_file5}{if random_cat_image_file6}
      <a href="{cat_url}"><img src="{random_cat_image_file6}" border="1"></a><br>
      {endif random_cat_image_file6}{if random_cat_image_file7}
      <a href="{cat_url}"><img src="{random_cat_image_file7}" border="1"></a><br>
      {endif random_cat_image_file7}{if random_cat_image_file8}
      <a href="{cat_url}"><img src="{random_cat_image_file8}" border="1"></a><br>
      {endif random_cat_image_file8}{if random_cat_image_file9}
      <a href="{cat_url}"><img src="{random_cat_image_file9}" border="1"></a><br>
      {endif random_cat_image_file9}
     
  <a href="{cat_url}" class="maincat">{cat_name}</a>&nbsp;({num_images})
      {if cat_is_new}<sup class="new">{lang_new}</sup>{endif cat_is_new}
</td>
  </tr>
</table>
{if cat_description}<span class="smalltext">{cat_description}</span><br />{endif cat_description}
{if sub_cats}{sub_cats}{endif sub_cats}

index.php
FIND:
Code: [Select]
unset($categories);ADD below:
Code: [Select]
//-----------------------------------------------------
//--- Show Category random images ---------------------------------
//-----------------------------------------------------
$cat_random_images = get_random_cat_random_images(0,10);
if (!$cat_random_images)  {
  $cat_random_images = $lang['no_categories'];
}
$site_template->register_vars("cat_random_images", $cat_random_images);
unset($cat_random_images);

And in home.html
REPLACE:
Code: [Select]
                  {if categories}
                  <table width="450" border="0" cellspacing="0" cellpadding="1">
                    <tr>
                      <td class="head1">
                        <table width="100%" border="0" cellspacing="0" cellpadding="3">
                          <tr>
                            <td class="head1" valign="top">{lang_categories}</td>
                          </tr>
                          <tr>
                            <td class="row2" valign="top">{categories}</td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
                  <br />
                  {endif categories}

BY:
Code: [Select]
                  {if cat_random_images}
                  <table width="450" border="0" cellspacing="0" cellpadding="1">
                    <tr>
                      <td class="head1">
                        <table width="100%" border="0" cellspacing="0" cellpadding="3">
                          <tr>
                            <td class="head1" valign="top">{lang_categories}</td>
                          </tr>
                          <tr>
                            <td class="row2" valign="top">{cat_random_images}</td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
                  <br />
                  {endif cat_random_images}

18
Mods & Plugins (Releases & Support) / Re: [MOD] multiupload
« on: June 22, 2005, 11:59:50 AM »
Thanks for bringing that up... It seemed I had some error in the above. I have commented out the possibility to use remote files in my own installation, and while converting to the original form I had some parenthesis errors...  :oops:

Now the MOD above is corrected...

[27 July 2005] removed the correction details, as they refer to older version

19
Sorry, I don't have a public homepage gallery... But here is a screenshot of the exif viewer working in my private gallery. By pressing the button, a javascript shows the exif data in image details page... of course one may choose to show this anyway one needs. For me it is that I want the details page to be as compact as possible.

20
Ok, so the MOD #2, the easiest is ready...

[MOD] MultiUpload
http://www.4homepages.de/forum/index.php?topic=8517.0

The other MODS require more work... so it takes some time.

Have fun.

21
Mods & Plugins (Releases & Support) / [MOD] multiupload
« on: June 22, 2005, 01:04:20 AM »
[MOD] MultiUpload
- This mod enables the users to add multiple files to a category at once.
- The images will get name and index, ie. "My pet", "My pet 2", "My pet 3",...
- for 4images 1.7.1

The best way to install this is to use the provided files, which give the changes compared to original installation of 4 images.

FILES
Files to be modified: (please take a backup copy of all of these!)
-categories.php  //settings
-categories.html  //To access the new action
-member.php //functionality (ie. looping the default upload method as long as required)

New files:
-member_multiuploadform.html //this is a simplified template for the multiupload
-two buttons... multiupload.gif, and multiupload_off.gif, I attached some as samples.

*NEW* I have included the clean versions of all these files to this post. They contain nothing more than the multiupload mod, it should be easy to integrate from there.


Recommended/required MODS
-auto thumbnailer and auto resizer MODs are highly recommended
-I also use my own EXIF reader and autorotate(according to the EXIF) MODs... these are yet to be released...


INSTALL
------------------------------------

I. SETTING THE VARIABLES

categories.php:

1.
AFTER:
Code: [Select]
$upload_button = "<img src=\"".get_gallery_image("upload_off.gif")."\" border=\"0\" alt=\"\" />";
ADD:
Code: [Select]
$multiupload_button = "<img src=\"".get_gallery_image("multiupload_off.gif")."\" border=\"0\" alt=\"MultiUpload images to this Gallery\" />";

2.
AFTER:
Code: [Select]
$upload_button = "<a href=\"".$upload_url."\"><img src=\"".get_gallery_image("upload.gif")."\" border=\"0\" alt=\"\" /></a>";
ADD:
Code: [Select]
$multiupload_url = $site_sess->url(ROOT_PATH."member.php?action=multiuploadform&amp;".URL_CAT_ID."=".$cat_id);
  $multiupload_button = "<a href=\"".$multiupload_url."\"><img src=\"".get_gallery_image("multiupload.gif")."\" border=\"0\" alt=\"Upload Multiple files\" /></a>";
 

3.
AFTER:
Code: [Select]
"upload_button" => $upload_button,
ADD:
Code: [Select]
"multiupload_button" => $multiupload_button,


categories.html
4.
REPLACE:
Code: [Select]
{upload_button}
BY:
Code: [Select]
{upload_button} {multiupload_button}





II. FUNCTIONALITY

member.php

1.
REPLACE:
Code: [Select]
if ($action == "uploadimage") {
BY:
Code: [Select]
if ($action == "uploadimage" || $action=="multiuploadimage") {


2.1
REPLACE:
Code: [Select]
if (!$error) {
    // Start Upload
    include(ROOT_PATH.'includes/upload.php');
    $site_upload = new Upload();

    // Upload Media file
    if (!empty($HTTP_POST_FILES['media_file']['tmp_name']) && $HTTP_POST_FILES['media_file']['tmp_name'] != "none") {
      $new_name = $site_upload->upload_file("media_file", "media", $upload_cat);
      if (!$new_name) {
        $msg .= (($msg != "") ? "<br />" : "")."<b>".$lang['file_upload_error'].": ".$new_name."</b><br />".$site_upload->get_upload_errors();
        $uploaderror = 1;
      }
    }
    else {
      $new_name = $remote_media_file;
    }
BY:
Code: [Select]
if (!$error) {
//MULTI FILE UPLOAD
$fileext="";
while(isset($HTTP_POST_FILES['media_file'.$fileext]))
{
include_once(ROOT_PATH.'includes/upload.php');
    $site_upload = new Upload();

    // Upload Media file
    if (!empty($HTTP_POST_FILES['media_file'.$fileext]['tmp_name']) && $HTTP_POST_FILES['media_file'.$fileext]['tmp_name'] != "none") {
      $new_name = $site_upload->upload_file('media_file'.$fileext, "media", $upload_cat);
      if (!$new_name) {
        $msg .= (($msg != "") ? "<br />" : "")."<b>".$lang['file_upload_error'].": ".$new_name."</b><br />".$site_upload->get_upload_errors();
        $uploaderror = 1;
      }
    }
    elseif($action=="uploadimage") {
      $new_name = $remote_media_file;
    }
    else
    {
    $new_name = "";
    break;
    }


2.2  * new *
REPLACE:
Code: [Select]
elseif ($config['auto_thumbnail'] == 1 && !empty($HTTP_POST_FILES['media_file']['tmp_name']) && $HTTP_POST_FILES['media_file']['tmp_name'] != "none" && !$uploaderror) {
BY:
Code: [Select]
elseif ($config['auto_thumbnail'] == 1 && !empty($HTTP_POST_FILES['media_file'.$fileext]['tmp_name']) && $HTTP_POST_FILES['media_file'.$fileext]['tmp_name'] != "none" && !$uploaderror) {


3.1 (NOW START REPLACING ALL THE includes and requires INSIDE THIS ACTION by include_once and require_once)
REPLACE:
Code: [Select]
require(ROOT_PATH.'includes/image_utils.php');
BY:
Code: [Select]
require_once(ROOT_PATH.'includes/image_utils.php');


3.2 do this to change the image names to have index
REPLACE:
Code: [Select]
if ($direct_upload) {
        $sql = "INSERT INTO ".IMAGES_TABLE."
                (cat_id, user_id, image_name, image_description, image_keywords, image_date, image_active, image_media_file, image_thumb_file, image_download_url, image_allow_comments".$additional_field_sql.")
                VALUES
                ($cat_id, ".$user_info['user_id'].", '$image_name', '$image_description', '$image_keywords', $current_time, $image_active, '$new_name', '$new_thumb_name', '$image_download_url', $image_allow_comments".$additional_value_sql.")";

BY:
Code: [Select]
$imgname = ($fileext!="")?"$image_name $fileext":$image_name;
  if ($direct_upload) {
$sql = "INSERT INTO ".IMAGES_TABLE."
(cat_id, user_id, image_name, image_description, image_keywords, image_date, image_active, image_media_file, image_thumb_file, image_download_url, image_allow_comments".$additional_field_sql.")
VALUES
($cat_id, ".$user_info['user_id'].", '$imgname', '$image_description', '$image_keywords', $current_time, $image_active, '$new_name', '$new_thumb_name', '$image_download_url', $image_allow_comments".$additional_value_sql.")";


4.
REPLACE:
Code: [Select]
include(ROOT_PATH.'includes/search_utils.php');
BY:
Code: [Select]
include_once(ROOT_PATH.'includes/search_utils.php');


5.
REPLACE:
Code: [Select]
include(ROOT_PATH.'includes/email.php');
BY:
Code: [Select]
include_once(ROOT_PATH.'includes/email.php');


6.
REPLACE:
Code: [Select]
$msg .= $lang['image_add_success'].": <b>".stripslashes($image_name)."</b> (".$new_name.")";BY:
Code: [Select]
      $msg .= $lang['image_add_success'].": <b>".stripslashes($image_name)."</b> (".$new_name.")<br>";
7. (almost over... )
REPLACE:
Code: [Select]
      $content .= "<table border=\"0\" align=\"center\">\n<tr>\n<td>\n".$media."\n</td>\n</tr>\n</table>\n";
    }
    else {
      $action = "uploadform";
      $sendprocess = 1;
    }
  }
  else {
    $action = "uploadform";
    $sendprocess = 1;
  }
}

if ($action == "uploadform") {
BY:
Code: [Select]
$content .= "<table border=\"0\" align=\"center\">\n<tr>\n<td>\n".$media."\n</td>\n</tr>\n</table>\n";
    $good=1;
  }
  else {
  //Atleast 1 multifile succeeded.
  if(count($HTTP_POST_FILES) && $good==1)
  {
  $action = "multiuploadform";
  break;
  }
  else
  {
  $action=($action=="multiuploadimage")?"multiuploadform":"uploadform";
  $sendprocess = 1;
  break; //break the while if any image upload fails
  }
  }
  $fileext=($fileext=="")?2:$fileext+1;
  }//end while
  }//end if
    else
    {
      $action = "uploadform";
      $sendprocess = 1;
    }
  }//end upload action
 
  //Show the form
if ($action == "uploadform" || $action == "multiuploadform") {

8. to parse the correct html...
REPLACE:
Code: [Select]
$content = $site_template->parse_template("member_uploadform");BY:
Code: [Select]
  if($action == "multiuploadform" || $action=="multiuploadimage")
    {
    $content = $site_template->parse_template("member_multiuploadform");
    }
    else
    {
    $content = $site_template->parse_template("member_uploadform");
  }


FINALLY...

III. CREATE A PAGE FOR MULTIUPLOAD FORM 'member_multiuploadform.html'
- download the file from below and copy it to your template folder (of course rename to member_multiuploadform.html)
- you may un-comment more file items, if you expect the users to download smaller files. For me 5 is quite enough when uploading jpgs directly from 5MP digital camera... (I  use the auto thumbnailer and auto resizer), but for photos from my 2MP camera I can use even 10...
- 4 images will just give (a bit misleading though), timeout error, if one tries to add too many images at once... complaining that you have invalid password(or something I can't recall...).
- Please edit this HTML to use your current locals (actually, you should add some variables to your language main.php -file...), I was too busy to do that.


...READY. Now starts the testing. :) (at first it is good to check that the 'normal' upload works as it used to... )


22 June 2005 CORRECTED the steps II.2 and II.7 were changed
23 June 2005 CORRECTED I fixed step II.2, incorrectly, leaving out the ".$fileext"-extension when checking the input files. And added a new II.2.2, to enable the auto thumbnailing...
26 July 2005 ADDED attachments of 'clean' multiupload files.
27 July 2005 UPDATED the instructions to match the provided files.

22
Hi,
I have just installed 4images a week ago. I have a background on PHP programming, and so I have done some modifications to my 4 images. I just wanted to ask if people would be interested if I'd write actual MOD instructions for these...

UPLOAD MODS

1. EXIF (No exif extension for PHP required!):

1a) [required] Extract and save Exif information -
saves exif to database before the image resize (which seems to lose this data),
and display it on a click of a button.

1b) [optional] Rotate images automatically, according to the Exif-Orientation


2. Multiupload - [DONE]
Upload multiple files with a simple interface. The amount depends on the file sizes, for me it works great with 5 images straight from 5MP camera, but gives timeout when I try 10. But it takes just fine 10 photos from my 2MP camera.

This is now ready... I hope it works...
http://www.4homepages.de/forum/index.php?topic=8517.0


3. better proportional (auto)resize (I use this with auto resize mod), to allow landscapes and portraits in, both Standard sized images (ie. <600 x <800) + Panoramas(ie. <600 x <3500):

-it works so that it makes sure the shorter side(can be either width or height) of an image is compared to the set limit and the longer side is proportionally resized accordingly (but it also has a maximum limit).

-the old one had to have limits 800x800, if you needed to allow same length in both landscapes and in portraits, which made it impossiple to add panoramas.


VIEW MODS

4. Random image thumbnail is searched from subfolders, if the main category doesn't have any.

...All these are ready and working together, I just ought to make the mod instructions for them (by comparing the original 1.7.1 release to the files I have modified...). I just don't know when I have the time... Which of these if any would you like to have? My gallery is a private kind, but I may provide screenshots, if you are interested.

23
Maybe there could be an option to use it or not in the installation.

Ie. a checkbox with text: Use Random image Optimization. And maybe a 'question mark', where it could explain what are the requirements for this optimization to work.

...or maybe the installer could check directly if the optimization can be used, by trying to create&delete a temp tables.

24
Discussion & Troubleshooting / Re: Uploading Poblem...yes another one
« on: June 15, 2005, 11:11:23 AM »
Thanks! It worked for me, when I increased the upload file size. For other users with 'CPanel' based hosting, it is possible to put an overriding 'php.ini' file to some directory. It affects in that dir and all subfolders.

I created php.ini -file with the following content:

Code: [Select]
;----------------------------------
;php.ini override
;----------------------------------
max_execution_time = 420  ; Maximum execution time of each script, in seconds (7secs)
upload_max_filesize = 5M  ; Maximum allowed size for uploaded files.

25
Discussion & Troubleshooting / Re: Uploading Poblem...yes another one
« on: June 15, 2005, 09:51:39 AM »
Hi,
I have the exact same problem. But it seems to occur only with larger images. For example, it doesn't work when I upload an image like this:
JPEG Quality: 100%
Size: 2475kb

But if compress the same image a bit(no pixel resize, just better compression) before upload - it works:
JPEG Quality: 90%
Size: 1379kb


...The error(not exactly) I get from the 4images after some time is: "Select an Image File!"

So it seems that there could be some problem with bigger files, or the time it takes to download those...

I have these settings for uploads, and Auto resize & Auto thumbnail both ON:

Image File:
Max. File Size: 3000 kb
Max. Image Width: 800 px
Max. Image Height: 800 px
Thumbnail File:
Max. File Size: 200 kb
Max. Image Width: 150 px
Max. Image Height: 300 px

And in phpinfo() I can read:
max_execution_time   420
safe_mode   Off

...and PHP is running as CGI.

Any ideas would be preciated. :)

Pages: 1 [2]