Forum Activity for @michael

michael
@michael
04/25/17 11:51:31PM
7,832 posts

Question about Facebook


Using Jamroom

not really. got a URL?
michael
@michael
04/25/17 07:07:19PM
7,832 posts

How to delete one uploaded temp file but keep others from the same form?


Jamroom Developers

This works:

function jrUjPano_form_validate_exit_listener($_data, $_user, $_conf, $_args, $event)
{ global $_post; if (isset($_post['upload_token'])) { $_fl = jrCore_get_uploaded_media_files('jrGallery', 'gallery_image'); if ($_fl && is_array($_fl) && isset($_fl[0])) { foreach ($_fl as $_img) { // check it is 2:1 $_tmp = getimagesize($_img); $w = (int) $_tmp[0]; $h = (int) $_tmp[1]; if ($w / $h !== 2) { // it isn't an equirectangular image //jrCore_delete_upload_temp_directory($_post['upload_token']); unlink($_img); unlink($_img .'.tmp'); jrCore_set_form_notice('notice', "Invalid Equirectangular Image"); jrCore_form_field_hilight('gallery_image'); jrCore_form_result(); } else { } } } } return $_data; }
if you upload 2 images and one of them is 2:1 and the other not, you will be returned to the form and the message shown. If you immediately submit again the 2:1 image will still be attached and will be saved.

Suggest the message read something like "picture_of_a_cat.png was not 2:1 so has been removed from your list. Submit again to save remaining files."

OR just remove it and continue the submit saving all the 2:1 images and if there is a non-2:1 image save a temp value with jrCore_set_temp_value() and make a smarty function to check that set temp value and show a message on the landing page "all images that were not 2:1 have been removed"
michael
@michael
04/25/17 06:55:38PM
7,832 posts

How to delete one uploaded temp file but keep others from the same form?


Jamroom Developers

Along with unset($img) also try unsetting the one with the .tmp extension.

                    unlink($_img);
                    unlink($_img .'.tmp');
Got any images that are 2:1 that will pass. need some of those to test further. looking for myself now.
michael
@michael
04/25/17 06:37:39PM
7,832 posts

How to delete one uploaded temp file but keep others from the same form?


Jamroom Developers

First observation, your using $_post, but its not there without global $_post; which you dont have.

--edit--
yes you are, you're getting it on every itteration of the foreach loop. sorry, see it now. Outside the loop's probably better.
updated by @michael: 04/25/17 06:45:10PM
michael
@michael
04/25/17 06:09:47PM
7,832 posts

Question about Facebook


Using Jamroom

Hard to break down any more, I don't know the situation. Like what page you're trying to add it to.

Meta Tag module:
https://www.jamroom.net/the-jamroom-network/networkmarket/ss=meta
michael
@michael
04/25/17 06:07:31PM
7,832 posts

How to delete one uploaded temp file but keep others from the same form?


Jamroom Developers

a form, with a multi-upload form field.
submit 10 images, but delete #8 for whatever reason and save the other 9.

I'll setup and see if I can see a way.
michael
@michael
04/25/17 02:38:28PM
7,832 posts

How to delete one uploaded temp file but keep others from the same form?


Jamroom Developers

maybe take a look at: jrCore_get_uploaded_media_files()

It uses jrCore_get_upload_temp_directory($_post['upload_token']);

then loops over them and finds the .tmp file in that directory and returns them. If you deleted the unwanted file from the directory that might work.

--- edit --
media.php
/**
 * Get media files that have been uploaded from a form
 * NOTE: $module is no longer used in this function, but was
 * at one time so is left there for backwards compatibility
 * @param string $module Module Name to check file for
 * @param string $file_name Name of file field in form
 * @return mixed
 */
function jrCore_get_uploaded_media_files($module = null, $file_name = null){
    global $_post;
    if (isset($_post['upload_token']{0})) {
        $dir = jrCore_get_upload_temp_directory($_post['upload_token']);
        if (is_dir($dir)) {
            if (is_null($file_name)) {
                $_tmp = glob("{$dir}/*.tmp", GLOB_NOSORT);
            }
            else {
                $_tmp = glob("{$dir}/*_{$file_name}.tmp", GLOB_NOSORT);
            }
            if ($_tmp && is_array($_tmp) && count($_tmp) > 0) {
                foreach ($_tmp as $k => $v) {
                    $_tmp[$k] = substr($v, 0, strlen($v) - 4);
                }
                sort($_tmp, SORT_NATURAL);
                return $_tmp;
            }
        }
    }
    return false;
}

updated by @michael: 04/25/17 02:39:19PM
michael
@michael
04/25/17 02:29:40PM
7,832 posts

Site can't be opened after changing tag in site builder


Ning To Jamroom

Check your version too, if its 2.0.3 and you're not using the beta jr6.1 there is an issue with site builder lately.

Forums: "Site Builder is Malfunctioning"
https://www.jamroom.net/the-jamroom-network/forum/new_posts/51515/site-builder-is-malfunctioning
michael
@michael
04/25/17 02:27:29PM
7,832 posts

Question about Facebook


Using Jamroom

What facebook shows is determined by what is found in the og:tags in the source code for the page. On the item detail pages these are set. You can adjust them by adjusting the item_detail_meta.tpl

For other pages you can use the meta tag module to set the og:tags as you want them.
  230