public static function generateImages($file_path, $dest, $command = 'upload', $type, $width, $height, $proportional) { $info = getimagesize($file_path); $ret = false; switch (strtolower($info['mime'])) { case 'image/png': case 'image/jpg': case 'image/jpeg': case 'image/gif': if (JFile::exists($dest) && !empty($dest)) { mt_srand(); $rand1 = mt_rand(0, mt_getrandmax()); mt_srand(); $rand2 = mt_rand(0, mt_getrandmax()); mt_srand(); $rand3 = mt_rand(0, mt_getrandmax()); mt_srand(); $rand4 = mt_rand(0, mt_getrandmax()); $dest = $original_path . '/' . $data['image_name'] . '-' . $rand1 . $rand2 . $rand3 . $rand4 . '.' . JFile::getExt(strtolower($file['name'])); } // This method should be expanded to be useable for other purposes not just making thumbs // But for now it just makes thumbs and proceed to the else part if ($command != 'thumb') { switch ($command) { case 'copy': if (!JFile::copy($file_path, $dest)) { return false; } break; case 'upload': default: if (!JFile::upload($file_path, $dest)) { return false; } break; } } else { // THUMB $src = $file_path; $src_path_info = pathinfo($src); $dest = $src_path_info['dirname'] . '/thumb/' . $src_path_info['filename'] . '_w' . $width . '_h' . $height . '_dope' . '.' . $src_path_info['extension']; $alt_dest = ''; if (!JFile::exists($dest)) { $ret = RedShopHelperImages::writeImage($src, $dest, $alt_dest, $width, $height, $proportional); } else { $ret = $dest; } } break; } return $ret; }