Weird issue with unique_id tag

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Weird issue with unique_id tag

Kevin Bice
When I upload images I change the file name to a unique name using (unique_id) + '.filetype’), and I create a thumbnail from the file with the new name that has just been uploaded. Sometime that thumbnail has ‘tn_’ appended to the front of the file name and is stored in the same directory, and in more recently coded sites I place the thumbnail with the exact same file name in a thumbnail directory.

I recently upgraded the server from 64-bit CentOS 5.9 with Lasso 8.6.1 to 64-bit CentOS 6.4 with 8.6.3 (using ImageMagick 6.5.4-7). Now I frequently see the thumbnail getting named something resembling the name of the first file uploaded, but the random string generated by unique_id when naming the first file is off by one character that is the 10th character in the random string. I never experienced this before upgrading OS and Lasso.

Sometime it works as it has for the last many years I have employed this method, but it can go back and forth between success and failure when loading up a set of images. I can even reload the same image to a record and get it to work correctly the second, third, or nth time.

Anyone else seeing this? Anyone have any ideas how I might remedy this?
.................................
Kevin Bice
512-879-1653
http://fmpweb.com
.................................
Web Development and Design




#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

RE: Weird issue with unique_id tag

Rick Draper-2
Hi Kevin,

It would be helpful to post a code snippet for us to review.  

Very best regards,

Rick




#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Weird issue with unique_id tag

Kevin Bice
The form allows up to 5 image files to be uploaded at a time. The upload code is as follows:

<?Lassoscript

        var:'ServerPath'=($catalogimages),'ServerPath1'=($catalogimages),'ServerPath3'=($catalogimages + 'detail_thumbs');


        if:!$ServerPath;

                var:'form_error'='A server path variable must be added to this file';

        else: (var_defined: '_Uploads_') && (((File_Uploads)->size) > 0);

        // Make sure path information submitted correctly

                        $ServerPath->(RemoveLeading:'/');
                        $ServerPath->(RemoveTrailing:'/');
                        $ServerPath=('/' + $ServerPath + '/');
                        $ServerPath1->(RemoveLeading:'/');
                        $ServerPath1->(RemoveTrailing:'/');
                        $ServerPath1=('/' + $ServerPath1 + '/');
                        $ServerPath3->(RemoveLeading:'/');
                        $ServerPath3->(RemoveTrailing:'/');
                        $ServerPath3=('/' + $ServerPath3 + '/');

                inline:-Username=$uname,-password=$pword;
                loop:((File_Uploads)->size);

                        var:'TempFilePath'=((File_Uploads)->(Get:(Loop_Count))->(Find:'upload.name'));
                        var:'FileSize'=((File_Uploads)->(Get:(Loop_Count))->(Find:'upload.size'));
                        var:'thatfile'=((File_Uploads)->(get:(loop_count))->(find:'upload.realname'));
                        var:'thisfile'=($thatfile->(split:'\\')->last);
                        var:'thisfiletype'=(string_lowercase:($thisfile->(split:'.')->last));
                        var:'newfile'=((unique_id) + '.' + ($thisfiletype));
                        var:'UsePath'=(($ServerPath) + ($newfile));

                 if:variable_defined:'uploadtype' && $uploadtype->size > 0 && $uploadtype->(find:$thisfiletype)->size > 0 && $FileSize <= $maxsize;

                 if:((File_Uploads)->(Get:(Loop_Count))->find:'upload.fieldname') == 'Graphic1';

                         (file_copy:$TempFilePath, $UsePath, -FileOverWrite);
                        include:'create_displayx.las';

                        //var:'graphic1'=$newfile;
                        if:integer:$autothumb;

                                include:'create_thumbx.las';

                        /if;

                 else:((File_Uploads)->(Get:(Loop_Count))->find:'upload.fieldname') == 'Graphic2';

                        (file_copy:$TempFilePath, $UsePath, -FileOverWrite);
                        //var:'graphic2'=$newfile;
                        include:'create_thumbx.las';

                 else:((File_Uploads)->(Get:(Loop_Count))->find:'upload.fieldname') == 'Graphic3';

                        var:'graphic3'=$newfile;
                        (file_copy:$TempFilePath, $UsePath, -FileOverWrite);
                        include:'create_detail.las';
                        include:'detail_thumb.las';

                 else:((File_Uploads)->(Get:(Loop_Count))->find:'upload.fieldname') == 'Graphic4';

                        var:'graphic4'=$newfile;
                        (file_copy:$TempFilePath, $UsePath, -FileOverWrite);
                        include:'create_detail.las';
                        include:'detail_thumb.las';

                 else:((File_Uploads)->(Get:(Loop_Count))->find:'upload.fieldname') == 'Graphic5';

                        var:'graphic5'=$newfile;
                        (file_copy:$TempFilePath, $UsePath, -FileOverWrite);
                        include:'create_detail.las';
                        include:'detail_thumb.las';

                 /if;


                 else:variable_defined:'uploadtype' && $uploadtype->size > 0;

                 var:'form_error'='Incorrect file type was uploaded. Only certain file types allowed. Read help note.';

                 else;

                 var:'form_error'='Upload failed. Allowed file types have not been defined.';

                 /if;

                /loop;
                /inline;

        /if;

?>

The ‘create_detail.las’ code is:

<?lassoscript
        var:'temp'=(image:($usepath));
        if:$temp->height > $temp->width && $temp->height > 680;

                $temp->(scale:-height=680);
                $temp->(save:($usepath));

        else:$temp->width > 1000;

                $temp->(scale:-width=1000);
                $temp->(save:($usepath));

        /if;
        if:$temp->width > 1000;

                $temp->(scale:-width=1000);
                $temp->(save:($usepath));

        /if;
?>

The ‘detail_thumb.las code is:

<?lassoscript
        var:'temp'=(image:($usepath));
                $temp->(scale:-height=50);
                var:'thispath'=(($ServerPath3) + ($newfile));
                $temp->(save:($thispath));
?>

You can see by the fact that there is some colon syntax still in play that this has been around for quite a while working just fine.

I appreciate your time with this.
.................................
Kevin Bice
512-879-1653
http://fmpweb.com
.................................
Web Development and Design



On Dec 12, 2015, at 5:13 PM, Rick Draper <[hidden email]> wrote:

> Hi Kevin,
>
> It would be helpful to post a code snippet for us to review.  
>
> Very best regards,
>
> Rick
>
>
>
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Weird issue with unique_id tag

Ric Lewis-3
In reply to this post by Kevin Bice
This is a known bug. Saving a single image works as expected. But saving a second copy alters the name of the *first* image file by one character, exactly as you describe. Not always, but perhaps one in five times. Our workaround was to use file copy for the second image, I'm not sure that bug was ever fixed in 8.6.3.

Sent from my iPhone

> On 12 Dec 2015, at 23:10, Kevin Bice <[hidden email]> wrote:
>
> When I upload images I change the file name to a unique name using (unique_id) + '.filetype’), and I create a thumbnail from the file with the new name that has just been uploaded. Sometime that thumbnail has ‘tn_’ appended to the front of the file name and is stored in the same directory, and in more recently coded sites I place the thumbnail with the exact same file name in a thumbnail directory.
>
> I recently upgraded the server from 64-bit CentOS 5.9 with Lasso 8.6.1 to 64-bit CentOS 6.4 with 8.6.3 (using ImageMagick 6.5.4-7). Now I frequently see the thumbnail getting named something resembling the name of the first file uploaded, but the random string generated by unique_id when naming the first file is off by one character that is the 10th character in the random string. I never experienced this before upgrading OS and Lasso.
>
> Sometime it works as it has for the last many years I have employed this method, but it can go back and forth between success and failure when loading up a set of images. I can even reload the same image to a record and get it to work correctly the second, third, or nth time.
>
> Anyone else seeing this? Anyone have any ideas how I might remedy this?
> .................................
> Kevin Bice
> 512-879-1653
> http://fmpweb.com
> .................................
> Web Development and Design
>
>
>
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Weird issue with unique_id tag

Kevin Bice
I guess I should devote more time to following the list.

I appreciate your time in helping me on the weekend. I am going to get to it changing over to file_copy to avoid having the problem. Thanks for that tip Ric.

Having to go through years of work making changes is what has kept me from moving to 9. I guess that staying with the older platform requires it too sometime.
.................................
Kevin Bice
512-879-1653
http://fmpweb.com
.................................
Web Development and Design



On Dec 12, 2015, at 5:27 PM, Ric Lewis <[hidden email]> wrote:

> This is a known bug. Saving a single image works as expected. But saving a second copy alters the name of the *first* image file by one character, exactly as you describe. Not always, but perhaps one in five times. Our workaround was to use file copy for the second image, I'm not sure that bug was ever fixed in 8.6.3.
>
> Sent from my iPhone
>
>> On 12 Dec 2015, at 23:10, Kevin Bice <[hidden email]> wrote:
>>
>> When I upload images I change the file name to a unique name using (unique_id) + '.filetype’), and I create a thumbnail from the file with the new name that has just been uploaded. Sometime that thumbnail has ‘tn_’ appended to the front of the file name and is stored in the same directory, and in more recently coded sites I place the thumbnail with the exact same file name in a thumbnail directory.
>>
>> I recently upgraded the server from 64-bit CentOS 5.9 with Lasso 8.6.1 to 64-bit CentOS 6.4 with 8.6.3 (using ImageMagick 6.5.4-7). Now I frequently see the thumbnail getting named something resembling the name of the first file uploaded, but the random string generated by unique_id when naming the first file is off by one character that is the 10th character in the random string. I never experienced this before upgrading OS and Lasso.
>>
>> Sometime it works as it has for the last many years I have employed this method, but it can go back and forth between success and failure when loading up a set of images. I can even reload the same image to a record and get it to work correctly the second, third, or nth time.
>>
>> Anyone else seeing this? Anyone have any ideas how I might remedy this?
>> .................................
>> Kevin Bice
>> 512-879-1653
>> http://fmpweb.com
>> .................................
>> Web Development and Design
>>
>>
>>
>>
>> #############################################################
>>
>> This message is sent to you because you are subscribed to
>> the mailing list Lasso [hidden email]
>> Official list archives available at http://www.lassotalk.com
>> To unsubscribe, E-mail to: <[hidden email]>
>> Send administrative queries to  <[hidden email]>
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Weird issue with unique_id tag

bienvenue
In reply to this post by Kevin Bice
Hi list

Kevin, we had an almost similar issue (Lasso 8.6 / CentOS 6.5), reported in this 2014 post
http://lasso.2283332.n4.nabble.com/A-weird-case-where-image-gt-save-changes-the-image-file-name-provided-td4642512.html

The name of file is not changed only when using lasso unique_id tag, but with any numbered names when saving more than on file through file manipulations.
Images are lost in directories and do not display, as their physical names do not match the one recorded in the database.

Name   "728192-666980.png"  ≠ File "728192-666980.gng" Here the extension has change !
Name   "12-666980.png"  ≠ File "12-666080.png" Here 9 becomes 0 !
Name   "12-632075.png"  ≠ File "12-632575.png" Here 0 becomes 5 !
Name   "11-132725.png"  ≠ File "11-132525.png" Here 7 becomes 5 !

As a workaround, we changed our way to manage thumbnails, and those type of file manipulation, by not using "bugged" lasso image tag anymore.
We rather use a graphic magick library trough OS_Process tag

Regards
JPK
----
E SYSTEMES - Lille France


Le 13 déc. 2015 à 00:10, Kevin Bice <[hidden email]> a écrit :

> When I upload images I change the file name to a unique name using (unique_id) + '.filetype’), and I create a thumbnail from the file with the new name that has just been uploaded. Sometime that thumbnail has ‘tn_’ appended to the front of the file name and is stored in the same directory, and in more recently coded sites I place the thumbnail with the exact same file name in a thumbnail directory.
>
> I recently upgraded the server from 64-bit CentOS 5.9 with Lasso 8.6.1 to 64-bit CentOS 6.4 with 8.6.3 (using ImageMagick 6.5.4-7). Now I frequently see the thumbnail getting named something resembling the name of the first file uploaded, but the random string generated by unique_id when naming the first file is off by one character that is the 10th character in the random string. I never experienced this before upgrading OS and Lasso.
>
> Sometime it works as it has for the last many years I have employed this method, but it can go back and forth between success and failure when loading up a set of images. I can even reload the same image to a record and get it to work correctly the second, third, or nth time.
>
> Anyone else seeing this? Anyone have any ideas how I might remedy this?
> .................................
> Kevin Bice
> 512-879-1653
> http://fmpweb.com
> .................................
> Web Development and Design
>
>
>
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>