I'm trying to create a few functions to take a user uploaded file, and then recreate it to (a) strip out the EXIF data, (b) shrink it down if it's too large.
And unfortunately, I'm not having any luck with the gdImageCreateFromJpeg()-type functions.
Here is what I have:
The l.file_path works; it returns the right path ('/test/graphics/thing/000077274-1396450271.jpg'). The Get_Extension() function works and returns the correct value. But the gdImage functions always return a -1 meaning it cannot find/handle the file.
Is there something else I'm missing? I tried looking at mivascript.com docs, but the image section is woefully behind.
Any suggestions?
Thanks
Usual disclaimer; this is not for Miva Merchant, so don't say "use this Merchant library" as I cannot. However, if there is something in the LSK that I could use as a starting point, that's cool.
And unfortunately, I'm not having any luck with the gdImageCreateFromJpeg()-type functions.
Here is what I have:
Code:
<MvASSIGN NAME = "l.file_path" VALUE = "{ g.source_path $ l.filename }"> <MvASSIGN NAME = "l.ext" VALUE = "{ Get_Extension( l.filename ) }"> <p>Filename: <MvEVAL EXPR = "{ l.file_path }"></p> <MvIF EXPR = "{ NOT sexists( l.file_path ) }"> <p>File does not exist</p> <MvFUNCTIONRETURN> </MvIF> <p>Extension: <MvEVAL EXPR = "{ l.ext }"></p> <MvIF EXPR = "{ tolower( l.ext ) EQ 'jpg' }"> <MvASSIGN NAME = "l.image" VALUE = "{ gdImageCreateFromJpeg( l.file_path, 'script' ) }" /> <MvELSEIF EXPR = "{ tolower( l.ext ) EQ 'jpeg' }"> <MvASSIGN NAME = "l.image" VALUE = "{ gdImageCreateFromJpeg( l.file_path, 'script' ) }" /> <MvELSEIF EXPR = "{ tolower( l.ext ) EQ 'png' }"> <MvASSIGN NAME = "l.image" VALUE = "{ gdImageCreateFromPng( l.file_path, 'script' ) }" /> <MvELSEIF EXPR = "{ tolower( l.ext ) EQ 'gif' }"> <MvASSIGN NAME = "l.image" VALUE = "{ gdImageCreateFromGif( l.file_path, 'script' ) }" /> <MvELSE> </MvIF> <MvEVAL EXPR = "{ 'Image: ' $ l.image }">
Is there something else I'm missing? I tried looking at mivascript.com docs, but the image section is woefully behind.
Any suggestions?
Thanks
Usual disclaimer; this is not for Miva Merchant, so don't say "use this Merchant library" as I cannot. However, if there is something in the LSK that I could use as a starting point, that's cool.
Comment