Ok this thing is kicking my ass. I have tried to implement a few different set ups. I even got it to upload but because of the way Scotty set this thing up it serves errors like Hors D’Oeuvres.
I have had a small amount of success using this...
if (!move_uploaded_file($_FILES['photo']['tmp_name'], $userImage.time()))
This above will allow me to upload an image and I can fine it in the /userimages/ folder.
Using a .gif file named
8_4_110[1].gif the end result will be
8_4_110[1].gif1216141196
So I thought I was close!
However ModX gives me this error:
PHP error debug
Error: getimagesize(/home/502view/public_html/assets/snippets/webloginpe/userimages/8_4_110[1].gif) [function.getimagesize]: failed to open stream: No such file or directory
Error type/ Nr.: Warning - 2
File: /home/502view/public_html/assets/snippets/webloginpe/webloginpe.class.php
Line: 2697
Line 2697 source: list($width, $height) = getimagesize($userImage);
So then I go to
getimagesize line and add to
($userimages)- I put
($userImage.time())
I then have to add
$userImage.time() to the
// Resample section Where php recognizes the extensions. It looks like below:
Note the "<----------"
// Resample
$image_p = imagecreatetruecolor($new_width, $new_height);
switch ($_FILES['photo']['type'])
{
case 'image/jpeg':
case 'image/jpg': // added support for .jpg to the "default" support for .jpeg, so WLPE doesn't give a filetype error
case 'image/pjpeg': // fix for IE6, which handles the .jpg filetype incorrectly
$image = imagecreatefromjpeg($userImage.time()); <----------
$ext = '.jpg';
break;
case 'image/gif':
$image = imagecreatefromgif($userImage.time()); <----------
imageSaveAlpha($image, true);
imagesavealpha($image_p, true);
$trans = imagecolorallocatealpha($image_p,255,255,255,127);
imagefill($image_p,0,0,$trans);
$ext = '.gif';
break;
case 'image/png':
$image = imagecreatefrompng($userImage.time()); <----------
imageSaveAlpha($image, true);
imagesavealpha($image_p, true);
$trans = imagecolorallocatealpha($image_p,255,255,255,127);
imagefill($image_p,0,0,$trans);
$ext = '.png';
break;
default :
return $this->FormatMessage($this->LanguageArray[30]);
break;
}
And then I have to add to the below due to another Modx error:
unlink($userImage.time());
Doing the above has no erros, However it does not add the time to the file. It starts to act as if the extra time code is not even there. It just uploads with the username.