mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-05 08:15:25 +02:00
Version 18.64.1
This commit is contained in:
parent
9d3f9fbebc
commit
36f6647379
|
@ -2354,8 +2354,9 @@ void Ctr_ReceivePhoto (void)
|
|||
size_t LengthExtension;
|
||||
char MIMEType[Brw_MAX_BYTES_MIME_TYPE + 1];
|
||||
char PathImgPriv[PATH_MAX + 1];
|
||||
char FileNameImgTmp[PATH_MAX + 1]; // Full name (including path and .jpg) of the destination temporary file
|
||||
char FileNameImg[PATH_MAX + 1]; // Full name (including path and .jpg) of the destination file
|
||||
char PathImgPrivTmp[PATH_MAX + 1];
|
||||
char PathFileImgTmp[PATH_MAX + 1]; // Full name (including path and .jpg) of the destination temporary file
|
||||
char PathFileImg[PATH_MAX + 1]; // Full name (including path and .jpg) of the destination file
|
||||
bool WrongType = false;
|
||||
char Command[1024 + PATH_MAX * 2];
|
||||
int ReturnCode;
|
||||
|
@ -2385,10 +2386,10 @@ void Ctr_ReceivePhoto (void)
|
|||
Fil_CreateDirIfNotExists (PathImgPriv);
|
||||
|
||||
/* Create temporary private directory for images if it does not exist */
|
||||
snprintf (PathImgPriv,sizeof (PathImgPriv),
|
||||
"%s/%s/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MEDIA,Cfg_FOLDER_IMG_TMP);
|
||||
Fil_CreateDirIfNotExists (PathImgPriv);
|
||||
snprintf (PathImgPrivTmp,sizeof (PathImgPrivTmp),
|
||||
"%s/%s",
|
||||
PathImgPriv,Cfg_FOLDER_IMG_TMP);
|
||||
Fil_CreateDirIfNotExists (PathImgPrivTmp);
|
||||
|
||||
/* Get filename extension */
|
||||
if ((PtrExtension = strrchr (FileNameImgSrc,(int) '.')) == NULL)
|
||||
|
@ -2405,11 +2406,10 @@ void Ctr_ReceivePhoto (void)
|
|||
}
|
||||
|
||||
/* End the reception of image in a temporary file */
|
||||
snprintf (FileNameImgTmp,sizeof (FileNameImgTmp),
|
||||
"%s/%s/%s/%s.%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MEDIA,Cfg_FOLDER_IMG_TMP,
|
||||
Gbl.UniqueNameEncrypted,PtrExtension);
|
||||
if (!Fil_EndReceptionOfFile (FileNameImgTmp,Param))
|
||||
snprintf (PathFileImgTmp,sizeof (PathFileImgTmp),
|
||||
"%s/%s.%s",
|
||||
PathImgPrivTmp,Gbl.UniqueNameEncrypted,PtrExtension);
|
||||
if (!Fil_EndReceptionOfFile (PathFileImgTmp,Param))
|
||||
{
|
||||
Ale_ShowAlert (Ale_WARNING,"Error copying file.");
|
||||
return;
|
||||
|
@ -2433,7 +2433,7 @@ void Ctr_ReceivePhoto (void)
|
|||
Fil_CreateDirIfNotExists (Path);
|
||||
|
||||
/***** Convert temporary file to public JPEG file *****/
|
||||
snprintf (FileNameImg,sizeof (FileNameImg),
|
||||
snprintf (PathFileImg,sizeof (PathFileImg),
|
||||
"%s/%s/%02u/%u/%u.jpg",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_CTR,
|
||||
(unsigned) (Gbl.CurrentCtr.Ctr.CtrCod % 100),
|
||||
|
@ -2443,11 +2443,11 @@ void Ctr_ReceivePhoto (void)
|
|||
/* Call to program that makes the conversion */
|
||||
snprintf (Command,sizeof (Command),
|
||||
"convert %s -resize '%ux%u>' -quality %u %s",
|
||||
FileNameImgTmp,
|
||||
PathFileImgTmp,
|
||||
Ctr_PHOTO_SAVED_MAX_WIDTH,
|
||||
Ctr_PHOTO_SAVED_MAX_HEIGHT,
|
||||
Ctr_PHOTO_SAVED_QUALITY,
|
||||
FileNameImg);
|
||||
PathFileImg);
|
||||
ReturnCode = system (Command);
|
||||
if (ReturnCode == -1)
|
||||
Lay_ShowErrorAndExit ("Error when running command to process image.");
|
||||
|
@ -2464,7 +2464,7 @@ void Ctr_ReceivePhoto (void)
|
|||
}
|
||||
|
||||
/***** Remove temporary file *****/
|
||||
unlink (FileNameImgTmp);
|
||||
unlink (PathFileImgTmp);
|
||||
|
||||
/***** Show the centre information again *****/
|
||||
Ctr_ShowConfiguration ();
|
||||
|
|
|
@ -432,10 +432,11 @@ En OpenSWAD:
|
|||
ps2pdf source.ps destination.pdf
|
||||
*/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.64 (2019-03-04)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.64.1 (2019-03-04)"
|
||||
#define CSS_FILE "swad18.64.css"
|
||||
#define JS_FILE "swad18.64.js"
|
||||
/*
|
||||
Version 18.64.1: Mar 04, 2019 Code refactoring in media. (238408 lines)
|
||||
Version 18.64: Mar 04, 2019 Allowing animated GIFs. Not finished. (238378 lines)
|
||||
Version 18.63.1: Mar 02, 2019 Allowing animated GIFs. Not finished. (238162 lines)
|
||||
Version 18.63: Mar 02, 2019 Allowing animated GIFs. Not finished. (238125 lines)
|
||||
|
|
|
@ -504,7 +504,7 @@ static long For_InsertForumPst (long ThrCod,long UsrCod,
|
|||
if (Media->Action == Med_ACTION_NEW_MEDIA && // Upload new image
|
||||
Media->Status == Med_FILE_PROCESSED) // The new image received has been processed
|
||||
/* Move processed image to definitive directory */
|
||||
Med_MoveMediaToDefinitiveDirectory (Media);
|
||||
Med_MoveMediaToDefinitiveDir (Media);
|
||||
|
||||
/***** Insert forum post in the database *****/
|
||||
PstCod =
|
||||
|
|
502
swad_media.c
502
swad_media.c
|
@ -80,11 +80,30 @@ static Med_Action_t Med_GetMediaActionFromForm (const char *ParamAction);
|
|||
static void Med_GetAndProcessFileFromForm (struct Media *Media,
|
||||
const char *ParamFile);
|
||||
|
||||
static void Med_ProcessJPG (struct Media *Media,
|
||||
const char PathMedPrivTmp[PATH_MAX + 1],
|
||||
const char PathFileOrg[PATH_MAX + 1]);
|
||||
static void Med_ProcessGIF (struct Media *Media,
|
||||
const char PathMedPrivTmp[PATH_MAX + 1],
|
||||
const char PathFileOrg[PATH_MAX + 1]);
|
||||
|
||||
static int Med_ResizeImage (struct Media *Media,
|
||||
const char *FileNameOriginal,
|
||||
const char *FileNameProcessed);
|
||||
static int Med_GetFirstFrame (const char *FileNameOriginal,
|
||||
const char *FileNameProcessed);
|
||||
const char PathFileOriginal[PATH_MAX + 1],
|
||||
const char PathFileProcessed[PATH_MAX + 1]);
|
||||
static int Med_GetFirstFrame (const char PathFileOriginal[PATH_MAX + 1],
|
||||
const char PathFileProcessed[PATH_MAX + 1]);
|
||||
|
||||
static bool Med_MoveTmpFileToDefDir (struct Media *Media,
|
||||
const char PathMedPrivTmp[PATH_MAX + 1],
|
||||
const char PathMedPriv[PATH_MAX + 1],
|
||||
const char *Extension);
|
||||
|
||||
static void Med_ShowJPG (struct Media *Media,
|
||||
const char PathMedPriv[PATH_MAX + 1],
|
||||
const char *ClassMedia);
|
||||
static void Med_ShowGIF (struct Media *Media,
|
||||
const char PathMedPriv[PATH_MAX + 1],
|
||||
const char *ClassMedia);
|
||||
|
||||
static Med_Type_t Med_GetTypeFromExtension (const char *Extension);
|
||||
|
||||
|
@ -424,20 +443,14 @@ static Med_Action_t Med_GetMediaActionFromForm (const char *ParamAction)
|
|||
static void Med_GetAndProcessFileFromForm (struct Media *Media,
|
||||
const char *ParamFile)
|
||||
{
|
||||
extern const char *Txt_The_image_could_not_be_processed_successfully;
|
||||
extern const char *Txt_The_size_of_the_gif_file_exceeds_the_maximum_allowed_X;
|
||||
struct Param *Param;
|
||||
char FileNameImgSrc[PATH_MAX + 1];
|
||||
char *PtrExtension;
|
||||
size_t LengthExtension;
|
||||
char MIMEType[Brw_MAX_BYTES_MIME_TYPE + 1];
|
||||
char PathImgPriv[PATH_MAX + 1];
|
||||
char FileNameOrig[PATH_MAX + 1]; // Full name of original uploaded file
|
||||
char FileNameJPGTmp[PATH_MAX + 1]; // Full name of temporary processed file
|
||||
char FileNamePNGTmp[PATH_MAX + 1]; // Full name of temporary processed file
|
||||
char FileNameGIFTmp[PATH_MAX + 1]; // Full name of temporary processed file
|
||||
struct stat FileStatus;
|
||||
char FileSizeStr[Fil_MAX_BYTES_FILE_SIZE_STRING + 1];
|
||||
char PathMedPriv[PATH_MAX + 1];
|
||||
char PathMedPrivTmp[PATH_MAX + 1];
|
||||
char PathFileOrg[PATH_MAX + 1]; // Full name of original uploaded file
|
||||
bool WrongType = false;
|
||||
|
||||
/***** Set media file status *****/
|
||||
|
@ -480,61 +493,97 @@ static void Med_GetAndProcessFileFromForm (struct Media *Media,
|
|||
|
||||
/***** Create private directories if not exist *****/
|
||||
/* Create private directory for images/videos if it does not exist */
|
||||
snprintf (PathImgPriv,sizeof (PathImgPriv),
|
||||
snprintf (PathMedPriv,sizeof (PathMedPriv),
|
||||
"%s/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MEDIA);
|
||||
Fil_CreateDirIfNotExists (PathImgPriv);
|
||||
Fil_CreateDirIfNotExists (PathMedPriv);
|
||||
|
||||
/* Create temporary private directory for images/videos if it does not exist */
|
||||
snprintf (PathImgPriv,sizeof (PathImgPriv),
|
||||
"%s/%s/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MEDIA,Cfg_FOLDER_IMG_TMP);
|
||||
Fil_CreateDirIfNotExists (PathImgPriv);
|
||||
snprintf (PathMedPrivTmp,sizeof (PathMedPrivTmp),
|
||||
"%s/%s",
|
||||
PathMedPriv,Cfg_FOLDER_IMG_TMP);
|
||||
Fil_CreateDirIfNotExists (PathMedPrivTmp);
|
||||
|
||||
/***** Remove old temporary private files *****/
|
||||
Fil_RemoveOldTmpFiles (PathImgPriv,Cfg_TIME_TO_DELETE_IMAGES_TMP_FILES,false);
|
||||
Fil_RemoveOldTmpFiles (PathMedPrivTmp,Cfg_TIME_TO_DELETE_IMAGES_TMP_FILES,false);
|
||||
|
||||
/***** End the reception of original not processed media
|
||||
(it may be very big) into a temporary file *****/
|
||||
Media->Status = Med_FILE_NONE;
|
||||
snprintf (FileNameOrig,sizeof (FileNameOrig),
|
||||
"%s/%s/%s/%s_original.%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MEDIA,Cfg_FOLDER_IMG_TMP,
|
||||
Media->Name,PtrExtension);
|
||||
snprintf (PathFileOrg,sizeof (PathFileOrg),
|
||||
"%s/%s_original.%s",
|
||||
PathMedPrivTmp,Media->Name,PtrExtension);
|
||||
|
||||
if (Fil_EndReceptionOfFile (FileNameOrig,Param)) // Success
|
||||
if (Fil_EndReceptionOfFile (PathFileOrg,Param)) // Success
|
||||
{
|
||||
Media->Status = Med_FILE_RECEIVED;
|
||||
|
||||
/* Depending on the media file extension... */
|
||||
/***** Process media depending on the media file extension *****/
|
||||
switch (Media->Type)
|
||||
{
|
||||
case Med_JPG:
|
||||
Med_ProcessJPG (Media,PathMedPrivTmp,PathFileOrg);
|
||||
break;
|
||||
case Med_GIF:
|
||||
Med_ProcessGIF (Media,PathMedPrivTmp,PathFileOrg);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/***** Remove temporary original file *****/
|
||||
if (Fil_CheckIfPathExists (PathFileOrg))
|
||||
unlink (PathFileOrg);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Process original image generating processed JPG ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Med_ProcessJPG (struct Media *Media,
|
||||
const char PathMedPrivTmp[PATH_MAX + 1],
|
||||
const char PathFileOrg[PATH_MAX + 1])
|
||||
{
|
||||
extern const char *Txt_The_image_could_not_be_processed_successfully;
|
||||
char PathFileJPGTmp[PATH_MAX + 1]; // Full name of temporary processed file
|
||||
|
||||
/***** Convert original media to temporary JPG processed file
|
||||
by calling to program that makes the conversion *****/
|
||||
snprintf (FileNameJPGTmp,sizeof (FileNameJPGTmp),
|
||||
"%s/%s/%s/%s.jpg",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MEDIA,Cfg_FOLDER_IMG_TMP,
|
||||
Media->Name);
|
||||
if (Med_ResizeImage (Media,FileNameOrig,FileNameJPGTmp) == 0) // On success ==> 0 is returned
|
||||
snprintf (PathFileJPGTmp,sizeof (PathFileJPGTmp),
|
||||
"%s/%s.jpg",
|
||||
PathMedPrivTmp,Media->Name);
|
||||
if (Med_ResizeImage (Media,PathFileOrg,PathFileJPGTmp) == 0) // On success ==> 0 is returned
|
||||
/* Success */
|
||||
Media->Status = Med_FILE_PROCESSED;
|
||||
else // Error processing media
|
||||
{
|
||||
/* Remove temporary destination media file */
|
||||
if (Fil_CheckIfPathExists (FileNameJPGTmp))
|
||||
unlink (FileNameJPGTmp);
|
||||
if (Fil_CheckIfPathExists (PathFileJPGTmp))
|
||||
unlink (PathFileJPGTmp);
|
||||
|
||||
/* Show error alert */
|
||||
Ale_ShowAlert (Ale_ERROR,Txt_The_image_could_not_be_processed_successfully);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******* Process original GIF image generating processed PNG and GIF *********/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Med_ProcessGIF (struct Media *Media,
|
||||
const char PathMedPrivTmp[PATH_MAX + 1],
|
||||
const char PathFileOrg[PATH_MAX + 1])
|
||||
{
|
||||
extern const char *Txt_The_image_could_not_be_processed_successfully;
|
||||
extern const char *Txt_The_size_of_the_gif_file_exceeds_the_maximum_allowed_X;
|
||||
struct stat FileStatus;
|
||||
char PathFilePNGTmp[PATH_MAX + 1]; // Full name of temporary processed file
|
||||
char PathFileGIFTmp[PATH_MAX + 1]; // Full name of temporary processed file
|
||||
char FileSizeStr[Fil_MAX_BYTES_FILE_SIZE_STRING + 1];
|
||||
|
||||
/***** Remove temporary original file *****/
|
||||
unlink (FileNameOrig);
|
||||
break;
|
||||
case Med_GIF:
|
||||
/***** Check size of media file *****/
|
||||
if (lstat (FileNameOrig,&FileStatus) == 0) // On success ==> 0 is returned
|
||||
if (lstat (PathFileOrg,&FileStatus) == 0) // On success ==> 0 is returned
|
||||
{
|
||||
/* Success */
|
||||
if (FileStatus.st_size <= (__off_t) Med_MAX_SIZE_GIF)
|
||||
|
@ -542,23 +591,21 @@ static void Med_GetAndProcessFileFromForm (struct Media *Media,
|
|||
/* File size correct */
|
||||
/***** Get first frame of orifinal GIF file
|
||||
and save it on temporary PNG file */
|
||||
snprintf (FileNamePNGTmp,sizeof (FileNamePNGTmp),
|
||||
"%s/%s/%s/%s.png",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MEDIA,Cfg_FOLDER_IMG_TMP,
|
||||
Media->Name);
|
||||
if (Med_GetFirstFrame (FileNameOrig,FileNamePNGTmp) == 0) // On success ==> 0 is returned
|
||||
snprintf (PathFilePNGTmp,sizeof (PathFilePNGTmp),
|
||||
"%s/%s.png",
|
||||
PathMedPrivTmp,Media->Name);
|
||||
if (Med_GetFirstFrame (PathFileOrg,PathFilePNGTmp) == 0) // On success ==> 0 is returned
|
||||
{
|
||||
/* Success */
|
||||
/***** Move original GIF file to temporary GIF file *****/
|
||||
snprintf (FileNameGIFTmp,sizeof (FileNameGIFTmp),
|
||||
"%s/%s/%s/%s.gif",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MEDIA,Cfg_FOLDER_IMG_TMP,
|
||||
Media->Name);
|
||||
if (rename (FileNameOrig,FileNameGIFTmp)) // Fail
|
||||
snprintf (PathFileGIFTmp,sizeof (PathFileGIFTmp),
|
||||
"%s/%s.gif",
|
||||
PathMedPrivTmp,Media->Name);
|
||||
if (rename (PathFileOrg,PathFileGIFTmp)) // Fail
|
||||
{
|
||||
/* Remove temporary PNG file */
|
||||
if (Fil_CheckIfPathExists (FileNamePNGTmp))
|
||||
unlink (FileNamePNGTmp);
|
||||
if (Fil_CheckIfPathExists (PathFilePNGTmp))
|
||||
unlink (PathFilePNGTmp);
|
||||
|
||||
/* Show error alert */
|
||||
Ale_ShowAlert (Ale_ERROR,Txt_The_image_could_not_be_processed_successfully);
|
||||
|
@ -566,11 +613,11 @@ static void Med_GetAndProcessFileFromForm (struct Media *Media,
|
|||
else // Success
|
||||
Media->Status = Med_FILE_PROCESSED;
|
||||
}
|
||||
else // Error processing media
|
||||
else // Error getting first frame
|
||||
{
|
||||
/* Remove temporary PNG file */
|
||||
if (Fil_CheckIfPathExists (FileNamePNGTmp))
|
||||
unlink (FileNamePNGTmp);
|
||||
if (Fil_CheckIfPathExists (PathFilePNGTmp))
|
||||
unlink (PathFilePNGTmp);
|
||||
|
||||
/* Show error alert */
|
||||
Ale_ShowAlert (Ale_ERROR,Txt_The_image_could_not_be_processed_successfully);
|
||||
|
@ -587,14 +634,6 @@ static void Med_GetAndProcessFileFromForm (struct Media *Media,
|
|||
else // Error getting file data
|
||||
/* Show error alert */
|
||||
Ale_ShowAlert (Ale_ERROR,Txt_The_image_could_not_be_processed_successfully);
|
||||
|
||||
/***** Remove temporary original file *****/
|
||||
unlink (FileNameOrig);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -604,19 +643,19 @@ static void Med_GetAndProcessFileFromForm (struct Media *Media,
|
|||
// Return != 0 on error
|
||||
|
||||
static int Med_ResizeImage (struct Media *Media,
|
||||
const char *FileNameOriginal,
|
||||
const char *FileNameProcessed)
|
||||
const char PathFileOriginal[PATH_MAX + 1],
|
||||
const char PathFileProcessed[PATH_MAX + 1])
|
||||
{
|
||||
char Command[256 + PATH_MAX * 2];
|
||||
int ReturnCode;
|
||||
|
||||
snprintf (Command,sizeof (Command),
|
||||
"convert %s -resize '%ux%u>' -quality %u %s",
|
||||
FileNameOriginal,
|
||||
PathFileOriginal,
|
||||
Media->Width,
|
||||
Media->Height,
|
||||
Media->Quality,
|
||||
FileNameProcessed);
|
||||
PathFileProcessed);
|
||||
ReturnCode = system (Command);
|
||||
if (ReturnCode == -1)
|
||||
Lay_ShowErrorAndExit ("Error when running command to process media.");
|
||||
|
@ -632,16 +671,16 @@ static int Med_ResizeImage (struct Media *Media,
|
|||
// Return 0 on success
|
||||
// Return != 0 on error
|
||||
|
||||
static int Med_GetFirstFrame (const char *FileNameOriginal,
|
||||
const char *FileNameProcessed)
|
||||
static int Med_GetFirstFrame (const char PathFileOriginal[PATH_MAX + 1],
|
||||
const char PathFileProcessed[PATH_MAX + 1])
|
||||
{
|
||||
char Command[128 + PATH_MAX * 2];
|
||||
int ReturnCode;
|
||||
|
||||
snprintf (Command,sizeof (Command),
|
||||
"convert '%s[0]' %s",
|
||||
FileNameOriginal,
|
||||
FileNameProcessed);
|
||||
PathFileOriginal,
|
||||
PathFileProcessed);
|
||||
ReturnCode = system (Command);
|
||||
if (ReturnCode == -1)
|
||||
Lay_ShowErrorAndExit ("Error when running command to process media.");
|
||||
|
@ -655,96 +694,80 @@ static int Med_GetFirstFrame (const char *FileNameOriginal,
|
|||
/**** Move temporary processed media file to definitive private directory ****/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Med_MoveMediaToDefinitiveDirectory (struct Media *Media)
|
||||
void Med_MoveMediaToDefinitiveDir (struct Media *Media)
|
||||
{
|
||||
char PathImgPriv[PATH_MAX + 1];
|
||||
char FileNameJPGTmp[PATH_MAX + 1]; // Full name of temporary processed file
|
||||
char FileNameJPG[PATH_MAX + 1]; // Full name of definitive processed file
|
||||
char FileNameGIFTmp[PATH_MAX + 1]; // Full name of temporary processed file
|
||||
char FileNameGIF[PATH_MAX + 1]; // Full name of definitive processed file
|
||||
char FileNamePNGTmp[PATH_MAX + 1]; // Full name of temporary processed file
|
||||
char FileNamePNG[PATH_MAX + 1]; // Full name of definitive processed file
|
||||
char PathMedPrivTmp[PATH_MAX + 1];
|
||||
char PathMedPriv[PATH_MAX + 1];
|
||||
|
||||
/***** Create subdirectory if it does not exist *****/
|
||||
snprintf (PathImgPriv,sizeof (PathImgPriv),
|
||||
/***** Build temporary path *****/
|
||||
snprintf (PathMedPrivTmp,sizeof (PathMedPrivTmp),
|
||||
"%s/%s/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MEDIA,Cfg_FOLDER_IMG_TMP);
|
||||
|
||||
/***** Create private subdirectory for media if it does not exist *****/
|
||||
snprintf (PathMedPriv,sizeof (PathMedPriv),
|
||||
"%s/%s/%c%c",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MEDIA,
|
||||
Media->Name[0],
|
||||
Media->Name[1]);
|
||||
Fil_CreateDirIfNotExists (PathImgPriv);
|
||||
Fil_CreateDirIfNotExists (PathMedPriv);
|
||||
|
||||
/***** Move files *****/
|
||||
switch (Media->Type)
|
||||
{
|
||||
case Med_JPG:
|
||||
/***** Temporary processed file *****/
|
||||
snprintf (FileNameJPGTmp,sizeof (FileNameJPGTmp),
|
||||
"%s/%s/%s/%s.jpg",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MEDIA,Cfg_FOLDER_IMG_TMP,
|
||||
Media->Name);
|
||||
|
||||
/***** Definitive processed file *****/
|
||||
snprintf (FileNameJPG,sizeof (FileNameJPG),
|
||||
"%s/%s/%c%c/%s.jpg",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MEDIA,
|
||||
Media->Name[0],
|
||||
Media->Name[1],
|
||||
Media->Name);
|
||||
|
||||
/***** Move file *****/
|
||||
if (rename (FileNameJPGTmp,FileNameJPG)) // Fail
|
||||
Ale_ShowAlert (Ale_ERROR,"Can not move file.");
|
||||
else // Success
|
||||
Media->Status = Med_FILE_MOVED;
|
||||
/* Move JPG */
|
||||
if (!Med_MoveTmpFileToDefDir (Media,PathMedPrivTmp,PathMedPriv,"jpg"))
|
||||
return; // Fail
|
||||
break;
|
||||
case Med_GIF:
|
||||
/***** Temporary PNG file *****/
|
||||
snprintf (FileNamePNGTmp,sizeof (FileNamePNGTmp),
|
||||
"%s/%s/%s/%s.png",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MEDIA,Cfg_FOLDER_IMG_TMP,
|
||||
Media->Name);
|
||||
|
||||
/***** Definitive PNG file *****/
|
||||
snprintf (FileNamePNG,sizeof (FileNamePNG),
|
||||
"%s/%s/%c%c/%s.png",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MEDIA,
|
||||
Media->Name[0],
|
||||
Media->Name[1],
|
||||
Media->Name);
|
||||
|
||||
/***** Move PNG file *****/
|
||||
if (rename (FileNamePNGTmp,FileNamePNG)) // Fail
|
||||
{
|
||||
Ale_ShowAlert (Ale_ERROR,"Can not move file.");
|
||||
return;
|
||||
}
|
||||
|
||||
/***** Temporary GIF file *****/
|
||||
snprintf (FileNameGIFTmp,sizeof (FileNameGIFTmp),
|
||||
"%s/%s/%s/%s.gif",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MEDIA,Cfg_FOLDER_IMG_TMP,
|
||||
Media->Name);
|
||||
|
||||
/***** Definitive GIF file *****/
|
||||
snprintf (FileNameGIF,sizeof (FileNameGIF),
|
||||
"%s/%s/%c%c/%s.gif",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MEDIA,
|
||||
Media->Name[0],
|
||||
Media->Name[1],
|
||||
Media->Name);
|
||||
|
||||
/***** Move GIF file *****/
|
||||
if (rename (FileNameGIFTmp,FileNameGIF)) // Fail
|
||||
{
|
||||
Ale_ShowAlert (Ale_ERROR,"Can not move file.");
|
||||
return;
|
||||
}
|
||||
|
||||
Media->Status = Med_FILE_MOVED;
|
||||
/* Move PNG */
|
||||
if (!Med_MoveTmpFileToDefDir (Media,PathMedPrivTmp,PathMedPriv,"png"))
|
||||
return; // Fail
|
||||
/* Move GIF */
|
||||
if (!Med_MoveTmpFileToDefDir (Media,PathMedPrivTmp,PathMedPriv,"gif"))
|
||||
return; // Fail
|
||||
break;
|
||||
default:
|
||||
Lay_ShowErrorAndExit ("Wrong media type.");
|
||||
break;
|
||||
}
|
||||
|
||||
Media->Status = Med_FILE_MOVED; // Success
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******* Move temporary processed file to definitive private directory *******/
|
||||
/*****************************************************************************/
|
||||
// Return true on success
|
||||
// Return false on error
|
||||
|
||||
static bool Med_MoveTmpFileToDefDir (struct Media *Media,
|
||||
const char PathMedPrivTmp[PATH_MAX + 1],
|
||||
const char PathMedPriv[PATH_MAX + 1],
|
||||
const char *Extension)
|
||||
{
|
||||
char PathFileTmp[PATH_MAX + 1]; // Full name of temporary processed file
|
||||
char PathFile[PATH_MAX + 1]; // Full name of definitive processed file
|
||||
|
||||
/***** Temporary processed media file *****/
|
||||
snprintf (PathFileTmp,sizeof (PathFileTmp),
|
||||
"%s/%s.%s",
|
||||
PathMedPrivTmp,Media->Name,Extension);
|
||||
|
||||
/***** Definitive processed media file *****/
|
||||
snprintf (PathFile,sizeof (PathFile),
|
||||
"%s/%s.%s",
|
||||
PathMedPriv,Media->Name,Extension);
|
||||
|
||||
/***** Move JPG file *****/
|
||||
if (rename (PathFileTmp,PathFile)) // Fail
|
||||
{
|
||||
Ale_ShowAlert (Ale_ERROR,"Can not move file.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true; // Success
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -754,13 +777,8 @@ void Med_MoveMediaToDefinitiveDirectory (struct Media *Media)
|
|||
void Med_ShowMedia (struct Media *Media,
|
||||
const char *ClassContainer,const char *ClassMedia)
|
||||
{
|
||||
extern const char *Txt_Image_not_found;
|
||||
char FileNameImgPriv[NAME_MAX + 1];
|
||||
char FullPathMediaPriv[PATH_MAX + 1];
|
||||
char URL_JPG[PATH_MAX + 1];
|
||||
char URL_GIF[PATH_MAX + 1];
|
||||
char URL_PNG[PATH_MAX + 1];
|
||||
bool PutLink;
|
||||
char PathMedPriv[PATH_MAX + 1];
|
||||
|
||||
/***** If no media to show ==> nothing to do *****/
|
||||
if (!Media->Name)
|
||||
|
@ -772,35 +790,69 @@ void Med_ShowMedia (struct Media *Media,
|
|||
if (Media->Status != Med_NAME_STORED_IN_DB)
|
||||
return;
|
||||
|
||||
/***** Check if optional link is present *****/
|
||||
PutLink = false;
|
||||
if (Media->URL)
|
||||
if (Media->URL[0])
|
||||
PutLink = true;
|
||||
|
||||
/***** Start media container *****/
|
||||
fprintf (Gbl.F.Out,"<div class=\"%s\">",ClassContainer);
|
||||
|
||||
/***** Start optional link to external URL *****/
|
||||
PutLink = false;
|
||||
if (Media->URL)
|
||||
if (Media->URL[0])
|
||||
PutLink = true;
|
||||
if (PutLink)
|
||||
fprintf (Gbl.F.Out,"<a href=\"%s\" target=\"_blank\">",Media->URL);
|
||||
|
||||
/***** Create a temporary public directory used to show the media *****/
|
||||
Brw_CreateDirDownloadTmp ();
|
||||
|
||||
/***** Build path to private directory with the media *****/
|
||||
snprintf (PathMedPriv,sizeof (PathMedPriv),
|
||||
"%s/%s/%c%c",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MEDIA,
|
||||
Media->Name[0],
|
||||
Media->Name[1]);
|
||||
|
||||
/***** Show media *****/
|
||||
switch (Media->Type)
|
||||
{
|
||||
case Med_JPG:
|
||||
Med_ShowJPG (Media,PathMedPriv,ClassMedia);
|
||||
break;
|
||||
case Med_GIF:
|
||||
Med_ShowGIF (Media,PathMedPriv,ClassMedia);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/***** End optional link to external URL *****/
|
||||
if (PutLink)
|
||||
fprintf (Gbl.F.Out,"</a>");
|
||||
|
||||
/***** End media container *****/
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************** Show a user uploaded JPG *************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Med_ShowJPG (struct Media *Media,
|
||||
const char PathMedPriv[PATH_MAX + 1],
|
||||
const char *ClassMedia)
|
||||
{
|
||||
extern const char *Txt_Image_not_found;
|
||||
char FileNameImgPriv[NAME_MAX + 1];
|
||||
char FullPathMediaPriv[PATH_MAX + 1];
|
||||
char URLTmp[PATH_MAX + 1];
|
||||
char URL_JPG[PATH_MAX + 1];
|
||||
|
||||
/***** Build private path to JPG *****/
|
||||
snprintf (FileNameImgPriv,sizeof (FileNameImgPriv),
|
||||
"%s.jpg",
|
||||
Media->Name);
|
||||
snprintf (FullPathMediaPriv,sizeof (FullPathMediaPriv),
|
||||
"%s/%s/%c%c/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MEDIA,
|
||||
Media->Name[0],
|
||||
Media->Name[1],
|
||||
FileNameImgPriv);
|
||||
"%s/%s",
|
||||
PathMedPriv,FileNameImgPriv);
|
||||
|
||||
/***** Check if private media file exists *****/
|
||||
if (Fil_CheckIfPathExists (FullPathMediaPriv))
|
||||
|
@ -809,12 +861,16 @@ void Med_ShowMedia (struct Media *Media,
|
|||
in order to gain access to it for showing/downloading *****/
|
||||
Brw_CreateTmpPublicLinkToPrivateFile (FullPathMediaPriv,FileNameImgPriv);
|
||||
|
||||
/***** Build temporary public URL *****/
|
||||
snprintf (URLTmp,sizeof (URLTmp),
|
||||
"%s/%s/%s",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_FILE_BROWSER_TMP,
|
||||
Gbl.FileBrowser.TmpPubDir);
|
||||
|
||||
/***** Create URL pointing to symbolic link *****/
|
||||
snprintf (URL_JPG,sizeof (URL_JPG),
|
||||
"%s/%s/%s/%s",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_FILE_BROWSER_TMP,
|
||||
Gbl.FileBrowser.TmpPubDir,
|
||||
FileNameImgPriv);
|
||||
"%s/%s",
|
||||
URLTmp,FileNameImgPriv);
|
||||
|
||||
/***** Show media *****/
|
||||
fprintf (Gbl.F.Out,"<img src=\"%s\" class=\"%s\" alt=\"\"",URL_JPG,ClassMedia);
|
||||
|
@ -825,18 +881,30 @@ void Med_ShowMedia (struct Media *Media,
|
|||
}
|
||||
else
|
||||
fprintf (Gbl.F.Out,"%s",Txt_Image_not_found);
|
||||
break;
|
||||
case Med_GIF:
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************** Show a user uploaded GIF *************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Med_ShowGIF (struct Media *Media,
|
||||
const char PathMedPriv[PATH_MAX + 1],
|
||||
const char *ClassMedia)
|
||||
{
|
||||
extern const char *Txt_Image_not_found;
|
||||
char FileNameImgPriv[NAME_MAX + 1];
|
||||
char FullPathMediaPriv[PATH_MAX + 1];
|
||||
char URLTmp[PATH_MAX + 1];
|
||||
char URL_GIF[PATH_MAX + 1];
|
||||
char URL_PNG[PATH_MAX + 1];
|
||||
|
||||
/***** Build private path to animated GIF image *****/
|
||||
snprintf (FileNameImgPriv,sizeof (FileNameImgPriv),
|
||||
"%s.gif",
|
||||
Media->Name);
|
||||
snprintf (FullPathMediaPriv,sizeof (FullPathMediaPriv),
|
||||
"%s/%s/%c%c/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MEDIA,
|
||||
Media->Name[0],
|
||||
Media->Name[1],
|
||||
FileNameImgPriv);
|
||||
"%s/%s",
|
||||
PathMedPriv,FileNameImgPriv);
|
||||
|
||||
/***** Check if private media file exists *****/
|
||||
if (Fil_CheckIfPathExists (FullPathMediaPriv))
|
||||
|
@ -845,35 +913,24 @@ void Med_ShowMedia (struct Media *Media,
|
|||
in order to gain access to it for showing/downloading *****/
|
||||
Brw_CreateTmpPublicLinkToPrivateFile (FullPathMediaPriv,FileNameImgPriv);
|
||||
|
||||
/***** Build temporary public URL *****/
|
||||
snprintf (URLTmp,sizeof (URLTmp),
|
||||
"%s/%s/%s",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_FILE_BROWSER_TMP,
|
||||
Gbl.FileBrowser.TmpPubDir);
|
||||
|
||||
/***** Create URL pointing to symbolic link *****/
|
||||
snprintf (URL_GIF,sizeof (URL_GIF),
|
||||
"%s/%s/%s/%s",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_FILE_BROWSER_TMP,
|
||||
Gbl.FileBrowser.TmpPubDir,
|
||||
FileNameImgPriv);
|
||||
|
||||
/***** Show animated GIF *****/
|
||||
/*
|
||||
fprintf (Gbl.F.Out,"<img id=\"%s\" src=\"%s\""
|
||||
" class=\"%s\" alt=\"\"",
|
||||
UniqueId,URL_GIF,ClassMedia);
|
||||
if (Media->Title)
|
||||
if (Media->Title[0])
|
||||
fprintf (Gbl.F.Out," title=\"%s\"",Media->Title);
|
||||
fprintf (Gbl.F.Out," style=\"display:none;\"" // Initially hidden
|
||||
" lazyload=\"on\" />"); // Lazy load of the media
|
||||
*/
|
||||
"%s/%s",
|
||||
URLTmp,FileNameImgPriv);
|
||||
|
||||
/***** Build private path to static PNG image *****/
|
||||
snprintf (FileNameImgPriv,sizeof (FileNameImgPriv),
|
||||
"%s.png",
|
||||
Media->Name);
|
||||
snprintf (FullPathMediaPriv,sizeof (FullPathMediaPriv),
|
||||
"%s/%s/%c%c/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MEDIA,
|
||||
Media->Name[0],
|
||||
Media->Name[1],
|
||||
FileNameImgPriv);
|
||||
"%s/%s",
|
||||
PathMedPriv,FileNameImgPriv);
|
||||
|
||||
/***** Check if private media file exists *****/
|
||||
if (Fil_CheckIfPathExists (FullPathMediaPriv))
|
||||
|
@ -884,18 +941,17 @@ void Med_ShowMedia (struct Media *Media,
|
|||
|
||||
/***** Create URL pointing to symbolic link *****/
|
||||
snprintf (URL_PNG,sizeof (URL_PNG),
|
||||
"%s/%s/%s/%s",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_FILE_BROWSER_TMP,
|
||||
Gbl.FileBrowser.TmpPubDir,
|
||||
FileNameImgPriv);
|
||||
"%s/%s",
|
||||
URLTmp,FileNameImgPriv);
|
||||
|
||||
/***** Show static PNG *****/
|
||||
/***** Show static PNG and animated GIF *****/
|
||||
fprintf (Gbl.F.Out,"<div class=\"MED_PLAY\""
|
||||
" onmouseover=\"toggleOnGIF(this,'%s');\""
|
||||
" onmouseout=\"toggleOffGIF(this,'%s');\">",
|
||||
URL_GIF,
|
||||
URL_PNG);
|
||||
|
||||
/* Image */
|
||||
fprintf (Gbl.F.Out,"<img src=\"%s\" class=\"%s\" alt=\"\"",
|
||||
|
||||
URL_PNG,
|
||||
|
@ -905,28 +961,19 @@ void Med_ShowMedia (struct Media *Media,
|
|||
fprintf (Gbl.F.Out," title=\"%s\"",Media->Title);
|
||||
fprintf (Gbl.F.Out," lazyload=\"on\" />"); // Lazy load of the media
|
||||
|
||||
/* Overlay with GIF label */
|
||||
fprintf (Gbl.F.Out,"<span class=\"MED_PLAY_ICO\">"
|
||||
"GIF"
|
||||
"</span>"
|
||||
"</div>");
|
||||
}
|
||||
else
|
||||
fprintf (Gbl.F.Out,"%s",Txt_Image_not_found);
|
||||
}
|
||||
else
|
||||
fprintf (Gbl.F.Out,"%s",Txt_Image_not_found);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
"</span>");
|
||||
|
||||
/***** End optional link to external URL *****/
|
||||
if (PutLink)
|
||||
fprintf (Gbl.F.Out,"</a>");
|
||||
|
||||
/***** End media container *****/
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
}
|
||||
else
|
||||
fprintf (Gbl.F.Out,"%s",Txt_Image_not_found);
|
||||
}
|
||||
else
|
||||
fprintf (Gbl.F.Out,"%s",Txt_Image_not_found);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**** Remove private file with an image/video, given the image/video name ****/
|
||||
|
@ -956,8 +1003,16 @@ void Med_RemoveMediaFileFromRow (MYSQL_RES *mysql_res)
|
|||
|
||||
void Med_RemoveMediaFile (const char *Name,Med_Type_t Type)
|
||||
{
|
||||
char PathMedPriv[PATH_MAX + 1];
|
||||
char FullPathMediaPriv[PATH_MAX + 1];
|
||||
|
||||
/***** Build path to private directory with the media *****/
|
||||
snprintf (PathMedPriv,sizeof (PathMedPriv),
|
||||
"%s/%s/%c%c",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MEDIA,
|
||||
Name[0],
|
||||
Name[1]);
|
||||
|
||||
if (Name[0])
|
||||
{
|
||||
switch (Type)
|
||||
|
@ -965,11 +1020,8 @@ void Med_RemoveMediaFile (const char *Name,Med_Type_t Type)
|
|||
case Med_JPG:
|
||||
/***** Build path to private file *****/
|
||||
snprintf (FullPathMediaPriv,sizeof (FullPathMediaPriv),
|
||||
"%s/%s/%c%c/%s.jpg",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MEDIA,
|
||||
Name[0],
|
||||
Name[1],
|
||||
Name);
|
||||
"%s/%s.jpg",
|
||||
PathMedPriv,Name);
|
||||
|
||||
/***** Remove private file *****/
|
||||
unlink (FullPathMediaPriv);
|
||||
|
@ -978,22 +1030,16 @@ void Med_RemoveMediaFile (const char *Name,Med_Type_t Type)
|
|||
case Med_GIF:
|
||||
/***** Build path to private GIF file *****/
|
||||
snprintf (FullPathMediaPriv,sizeof (FullPathMediaPriv),
|
||||
"%s/%s/%c%c/%s.gif",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MEDIA,
|
||||
Name[0],
|
||||
Name[1],
|
||||
Name);
|
||||
"%s/%s.gif",
|
||||
PathMedPriv,Name);
|
||||
|
||||
/***** Remove private file *****/
|
||||
unlink (FullPathMediaPriv);
|
||||
|
||||
/***** Build path to private PNG file *****/
|
||||
snprintf (FullPathMediaPriv,sizeof (FullPathMediaPriv),
|
||||
"%s/%s/%c%c/%s.png",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MEDIA,
|
||||
Name[0],
|
||||
Name[1],
|
||||
Name);
|
||||
"%s//%s.png",
|
||||
PathMedPriv,Name);
|
||||
|
||||
/***** Remove private file *****/
|
||||
unlink (FullPathMediaPriv);
|
||||
|
|
|
@ -144,7 +144,7 @@ void Med_GetMediaFromForm (int NumMediaInForm,struct Media *Media,
|
|||
void (*GetMediaFromDB) (int NumMediaInForm,struct Media *Media));
|
||||
void Med_SetParamNames (struct ParamUploadMedia *ParamUploadMedia,int NumMediaInForm);
|
||||
|
||||
void Med_MoveMediaToDefinitiveDirectory (struct Media *Media);
|
||||
void Med_MoveMediaToDefinitiveDir (struct Media *Media);
|
||||
void Med_ShowMedia (struct Media *Media,
|
||||
const char *ClassContainer,const char *ClassMedia);
|
||||
|
||||
|
|
|
@ -1285,7 +1285,7 @@ static long Msg_InsertNewMsg (const char *Subject,const char *Content,
|
|||
if (Media->Action == Med_ACTION_NEW_MEDIA && // Upload new image
|
||||
Media->Status == Med_FILE_PROCESSED) // The new image received has been processed
|
||||
/* Move processed image to definitive directory */
|
||||
Med_MoveMediaToDefinitiveDirectory (Media);
|
||||
Med_MoveMediaToDefinitiveDir (Media);
|
||||
|
||||
/***** Insert message subject and content in the database *****/
|
||||
MsgCod =
|
||||
|
|
|
@ -2463,7 +2463,7 @@ static long Soc_ReceiveSocialPost (void)
|
|||
if (Media.Action == Med_ACTION_NEW_MEDIA && // Upload new image
|
||||
Media.Status == Med_FILE_PROCESSED) // The new image received has been processed
|
||||
/* Move processed image to definitive directory */
|
||||
Med_MoveMediaToDefinitiveDirectory (&Media);
|
||||
Med_MoveMediaToDefinitiveDir (&Media);
|
||||
|
||||
/***** Publish *****/
|
||||
/* Insert post content in the database */
|
||||
|
@ -3191,7 +3191,7 @@ static long Soc_ReceiveComment (void)
|
|||
if (Media.Action == Med_ACTION_NEW_MEDIA && // Upload new image
|
||||
Media.Status == Med_FILE_PROCESSED) // The new image received has been processed
|
||||
/* Move processed image to definitive directory */
|
||||
Med_MoveMediaToDefinitiveDirectory (&Media);
|
||||
Med_MoveMediaToDefinitiveDir (&Media);
|
||||
|
||||
/***** Publish *****/
|
||||
/* Insert into publishings */
|
||||
|
|
|
@ -6180,7 +6180,7 @@ static void Tst_MoveMediaToDefinitiveDirectories (void)
|
|||
Gbl.Test.Media.Action == Med_ACTION_CHANGE_MEDIA) && // Replace existing image by new image
|
||||
Gbl.Test.Media.Status == Med_FILE_PROCESSED) // The new image received has been processed
|
||||
/* Move processed image to definitive directory */
|
||||
Med_MoveMediaToDefinitiveDirectory (&Gbl.Test.Media);
|
||||
Med_MoveMediaToDefinitiveDir (&Gbl.Test.Media);
|
||||
|
||||
/****** Move images associated to answers *****/
|
||||
if (Gbl.Test.AnswerType == Tst_ANS_UNIQUE_CHOICE ||
|
||||
|
@ -6200,7 +6200,7 @@ static void Tst_MoveMediaToDefinitiveDirectories (void)
|
|||
Gbl.Test.Answer.Options[NumOpt].Media.Action == Med_ACTION_CHANGE_MEDIA) && // Replace existing image by new image
|
||||
Gbl.Test.Answer.Options[NumOpt].Media.Status == Med_FILE_PROCESSED) // The new image received has been processed
|
||||
/* Move processed image to definitive directory */
|
||||
Med_MoveMediaToDefinitiveDirectory (&Gbl.Test.Answer.Options[NumOpt].Media);
|
||||
Med_MoveMediaToDefinitiveDir (&Gbl.Test.Answer.Options[NumOpt].Media);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user