• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.

[Unofficial] Recents Users Uploaded Images Without DB

Status
Not open for further replies.

Danny.Domb

👽 Chevereto Freak
This is the answer to the request from Izam2 that can be found Here

Require Very Simple Plugin System

This is a simple mod to keep in a session the recent uploads of a users.

Installation Instructions
Download : http://www.mediafire.com/?237phtatezunm1j
Edit it both files to match your preferences.
Upload uploadedImages.php in content/mods/
Upload myUploads.php in content/themes/yourThemes/pages

open index.php
find
PHP:
<?php

add after
PHP:
define('KEEP_SESSION_IN_DAYS', 10);
ini_set('session.gc_maxlifetime', KEEP_SESSION_IN_DAYS*86400);

open content/themes/yourThemes/pages/pages_config.php
find
PHP:
'contact'	=> array('live' => true, 'title' => 'Contact'),

add after
PHP:
'myUploads'	=> array('live' => true, 'title' => 'My Recents Uploads'),

open includes/uploader.php
find
PHP:
$_SESSION['ImagesUp'][str_replace('.', '', $upload->image_info['img_name'])] = $imageInfo;

add after
PHP:
uploadedImages_add($upload->image_info['img_name']);


Information given by this add-ons:
Code:
an array ($_SESSION[__MOD__UPLOADED_IMAGES__NAME__]) of the X recents uploads made by this user

Suggestions
None


Known Issues
None.



If you like this add-ons thumbs me up!
 
great!

but the first time i tried to install it, didn't work
now my second try xD


btw what mean and where is supposed to place this code?

Information given by this add-ons:
an array ($_SESSION[__MOD__UPLOADED_IMAGES__NAME__]) of the X recents uploads made by this user

???
 
when i put this line:

Code:
/*** Include the mods ***/
foreach (glob(__PATH_MODS__."*.php") as $file)
{
    include($file);
}



i get the next msg when i open my site:
Code:
This file cannot be directly accessed.
 
for the first post, I would recommend you to understand the basic of an array, really simple, you can read it here:
http://php.net/manual/en/language.types.array.php

Exemple in the case of this script:
Code:
Array
(
    [0] => 'img1.jpg',
    [1] => 'img2.jpg',
    [2] => 'img3.jpg',
)

so you can simply do in php and "echo" of "$_SESSION[__MOD__UPLOADED_IMAGES__NAME__][0]" and this will print to your web page without the quotes "img1.jpg"

An array is an very efficient ways to store multiple information.

------------------------------------------------------------------------------------------------------------------------------------------

Now for the second topic:

Are you trying to access the files directly ? Like (http://yourwebsite.com/chevereto/content/mods/uploadedImages.php)

if yes, then it is normal that you get this error, simply because it was not create to be used as a page, simply a file to store functions to be used from anywhere in the script.

if no, then, please reply back, we will try to fix it ;)
 
ok , this is the order.

1.- install chevereto - Ok
2. -install very simple plugin script - Ok
3.- install Recent Images - Ok
4.- i open my site and show me
Code:
This file cannot be directly accessed

so i ll check all the code and the problem is
Code:
/*** Include the mods ***/
foreach (glob(__PATH_MODS__."*.php") as $file)
{
    include($file);
}

if i delete that part in "chevereto.php" my site open.
@.@
 
Could you make sure you added the define(__PATH_MODS__' ... into the chevereto.php file?

Also, could you check if on your server an error_log.txt files is created?

Because as far as I understand, the reason why it is not working it because php create an error, and the access constant isn't defined, so all page will show the message you got.

Also, you could try to remove the if clause for the mkdir and make sure to create the folder manually.
 
izam2 said:
great is working now.
so, sessions expire when i close the browse right?

if you followed the first step in editing index.php

PHP:
define('KEEP_SESSION_IN_DAYS', 10);
ini_set('session.gc_maxlifetime', KEEP_SESSION_IN_DAYS*86400);

The session should expire after the number of days you wrote.
 
Great add on.

Ive edited the script for the moment to link to the picture and made it nicer all round. However I would like to link it to the viewer page when I click on an image thumb. How would I get that done?

My present code from myUploads.php
Code:
<div id="uploaded_list" >
            <?php
                foreach($_SESSION[__MOD__UPLOADED_IMAGES__NAME__] as $element)
                print('<a href="'.absolute_to_url(__PATH_IMAGES__.$element).'" /><img src="'.absolute_to_url(__PATH_THUMBS__.$element).'" style="border: 1px solid #999; padding: 3px;" /></a>');
            ?>
        </div>
 
Spankeh said:
print('<a href="'.absolute_to_url(__PATH_IMAGES__.$element).'" /><img src="'.absolute_to_url(__PATH_THUMBS__.$element).'" style="border: 1px solid #999; padding: 3px;" /></a>');

Replace :
PHP:
                print('<a href="'.absolute_to_url(__PATH_IMAGES__.$element).'" /><img src="'.absolute_to_url(__PATH_THUMBS__.$element).'" style="border: 1px solid #999; padding: 3px;" /></a>');

With
PHP:
                print('<a href="'.__BASE_URL__.'?v='.$element.'" /><img src="'.absolute_to_url(__PATH_THUMBS__.$element).'" style="border: 1px solid #999; padding: 3px;" /></a>');
 
Please keep in mind that since 2.0.3 the definitions are like __CHV_BASE_URL__
 
How can i display for each image the date/time of the upload?

And how can change the arrangement?
i want them vertical
 
I'll try this tomorrow.

But how can i change the order?

In addition this addon shows us the latest uploaded images, but the newest image you uploaded is the last in the list.... how can i change that the newest one is on top?
 
Avast said:
I'll try this tomorrow.

But how can i change the order?

In addition this addon shows us the latest uploaded images, but the newest image you uploaded is the last in the list.... how can i change that the newest one is on top?

replace :
PHP:
			foreach($_SESSION[__MOD__UPLOADED_IMAGES__NAME__] as $element)
				print('<img src="'.absolute_to_url(__PATH_IMAGES__.$element).'" /><br />');

With :

PHP:
			for ($i = sizeof($_SESSION[__MOD__UPLOADED_IMAGES__NAME__]); $i >= 0; $i--)
				print('<img src="'.absolute_to_url(__PATH_IMAGES__.$_SESSION[__MOD__UPLOADED_IMAGES__NAME__][$i]).'" /><br />');
 
If i replace this:

Code:
foreach($_SESSION[__MOD__UPLOADED_IMAGES__NAME__] as $element)

with:

Code:
for ($i = sizeof($_SESSION[__MOD__UPLOADED_IMAGES__NAME__]; i > 0; i--)

my editor alerts an syntax error....
 
Avast said:
If i replace this:

Code:
foreach($_SESSION[__MOD__UPLOADED_IMAGES__NAME__] as $element)

with:

Code:
for ($i = sizeof($_SESSION[__MOD__UPLOADED_IMAGES__NAME__]; i > 0; i--)

my editor alerts an syntax error....

forgot an ) xD

Code:
 for ($i = sizeof($_SESSION[__MOD__UPLOADED_IMAGES__NAME__]); $i >= 0; $i--)
 
Status
Not open for further replies.
Back
Top