Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
gargantouas  
#1 Posted : Tuesday, November 4, 2008 9:07:12 PM(UTC)
gargantouas

Rank: Newbie

Groups: Member
Joined: 11/4/2008(UTC)
Posts: 4

Hi there,
very nice work on the uploader. I am trying to evaluate the version (downloaded demo) and I am using it on the development phase of my project.
So far no problem. Everything works fine. However I cannot figure out the three points I am describing below:
1)
The iu.addParam("UploadSourceFile", "false"); method does no work for me. I have to set the value to TRUE and i dont want that. I want only the thumbnail and a resized image to be uploaded on the server. That is I do not want to have resulting files more than 100KB if possible...how do I achieve that?
2)
How do I grab in PHP the Description field in order to enter its value to a database table? would that be something like $description= $_FILES['Description' . $i] ?
3)
I try to upload images with greek filenames for example Εικονα1.jpg (of course I dont expect for you to understand what Εικονα1 means -it means Picture1.jpg-) and I get the result as this "Εικόνα001.jpg". How can I fix that?

Thank you very much....

Edited by user Tuesday, November 4, 2008 9:08:21 PM(UTC)  | Reason: Not specified

Fedor  
#2 Posted : Tuesday, November 4, 2008 9:40:59 PM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
Hello,

Quote:
very nice work on the uploader. I am trying to evaluate the version (downloaded demo) and I am using it on the development phase of my project.
So far no problem. Everything works fine. However I cannot figure out the three points I am describing below:


Thank you, we highly appreciate it. First of all I recommend you to check the samples from Image Uploader SDK. They contain answers on most of your questions.

Quote:
1)
The iu.addParam("UploadSourceFile", "false"); method does no work for me. I have to set the value to TRUE and i dont want that. I want only the thumbnail and a resized image to be uploaded on the server. That is I do not want to have resulting files more than 100KB if possible...how do I achieve that?


Yes, it is possible. Please see Web Gallery paragraph in the bottom of Resizing and Rotating Images topic. Here is the code you can use:

Code:
<script type="text/javascript" src="iuembed.js"></script>

<script type="text/javascript">
var iu = new ImageUploaderWriter("ImageUploader", 710, 500);

//...other params...

iu.addParam("UploadSourceFile", "false");
iu.addParam("AllowRotate", "false");

iu.addParam("UploadThumbnail1FitMode", "Fit");
iu.addParam("UploadThumbnail1Width", "100");
iu.addParam("UploadThumbnail1Height", "100");
iu.addParam("UploadThumbnail1JpegQuality", "40");

iu.addParam("UploadThumbnail2FitMode", "Fit");
iu.addParam("UploadThumbnail2Width", "640");
iu.addParam("UploadThumbnail2Height", "480");
iu.addParam("UploadThumbnail2JpegQuality", "65");

//...

iu.writeHtml();
</script>


You can also see Optimized Upload Sample for more info.

Quote:
2)
How do I grab in PHP the Description field in order to enter its value to a database table? would that be something like $description= $_FILES['Description' . $i] ?


You should use something like:

Code:
$description = $_POST ['Description_' . $i];


Quote:
3)
I try to upload images with greek filenames for example Εικονα1.jpg (of course I dont expect for you to understand what Εικονα1 means -it means Picture1.jpg-) and I get the result as this "Εικόνα001.jpg". How can I fix that?


By default Image Uploader sends data to server in UTF-8 encoding (you can change it using ImageUploader.Charset Property) at that time as PHP uses ISO-8859-1/Latin-1 encoding. To resolve it you should process strings in PHP using UTF-8:

Please try to Google or check this blog post for more info:

http://www.dangrossman.i...-and-non-utf8-databases/
Best regards,
Fedor Skvortsov
gargantouas  
#3 Posted : Wednesday, November 5, 2008 2:01:02 AM(UTC)
gargantouas

Rank: Newbie

Groups: Member
Joined: 11/4/2008(UTC)
Posts: 4

Hi Fedor and thank you for the quick response.
As it concerns point 3, i managed to overcome it by creating a unique file name on the server using the uniqid() function.
as it concerns the point 1 it still doesnt work. I must be missing something. When I turn the iu.addParam("UploadSourceFile", "true"); parameter to false it will not upload anything....I am going to give you the code I am using both on the client side and on the server side just in case you can help me. Thank you.

Client Side Code:
Code:

<script language="javascript">
var iu = new ImageUploaderWriter("ImageUploader", 650, 450);

//Configure License Keys
iu.addParam("LicenseKey", "71050-4658A-00000-06E9E-EF280;72050-4658A-00000-0A73B-88BD2");

// If you do not want to use ActiveX or Java version, set the appropriate
// property to false.
iu.activeXControlEnabled = false;
iu.javaAppletEnabled = true;

iu.activeXControlCodeBase = "ImageUploader5.cab";
iu.javaAppletCodeBase="./";


//Configure appearance.
iu.addParam("PaneLayout", "TwoPanes");
iu.addParam("ShowDebugWindow", "true");
iu.addParam("AllowRotate", "false");
iu.addParam("BackgroundColor", "#ccccff");
iu.addParam("FileMask", "*.jpg;*.jpeg;*.jpe;*.png");
iu.addParam("Charset", "UTF-8");

iu.addParam("UploadSourceFile", "false");
iu.addParam("MaxFileSize", "600000");
iu.addParam("MaxTotalFileSize", "2000000");
iu.addParam("MaxDescriptionTextLength", "100");

//Configure thumbnail settings.
iu.addParam("UploadThumbnail2FitMode", "Fit");
iu.addParam("UploadThumbnail2Width", "600");
iu.addParam("UploadThumbnail2Height", "460");
iu.addParam("UploadThumbnail2JpegQuality", "100");


//Configure thumbnail settings.
iu.addParam("UploadThumbnail1FitMode", "Fit");
iu.addParam("UploadThumbnail1Width", "120");
iu.addParam("UploadThumbnail1Height", "120");
iu.addParam("UploadThumbnail1JpegQuality", "100");


//Configure URL files are uploaded to.
iu.addParam("Action", "upload_src.php")

//Configure URL where to redirect after upload.
iu.addParam("RedirectUrl", "uploader.php")

iu.writeHtml();
</script>



Server Side Code:
Code:

<?php
//This variable specifies relative path to the folder, where the gallery 
//with uploaded files is located.
$galleryPath = "images/img/";

$absGalleryPath = realpath($galleryPath) . "/";

//Get total number of uploaded files (all files are uploaded in a single package).
$fileCount = $_POST ["FileCount"];

//Iterate through uploaded data and save the original file and thumbnail.
for ($i = 1; $i <= $fileCount; $i++)
{
    //Get source file and save it to disk.
    $sourceFileField = "SourceFile_" . $i;
    $mime_image = $_FILES[$sourceFileField]['type'];
	//generate a unique filename
	$unique_name = uniqid();
	switch ($mime_image){

	case "image/gif" :
		$file_name = $unique_name . ".gif";
	break;
	case "image/jpeg" :
		$file_name = $unique_name . ".jpg";
	break;
	case "image/pjpeg" :
		$file_name = $unique_name . ".jpg";
	break;
	case "image/png" :
		$file_name =$unique_name .  ".png";
	break;
} // end switch generate a unique filename
	
    move_uploaded_file($_FILES[$sourceFileField]["tmp_name"], 
        $absGalleryPath . "/" . $file_name);

    //Get first thumbnail (the single thumbnail in this code sample) and save it to disk.
    $thumbnail1Field = "Thumbnail2_" . $i;
    move_uploaded_file($_FILES[$thumbnail1Field]["tmp_name"], 
        "images/img/" . $file_name);
	
	
	//Get first thumbnail (the single thumbnail in this code sample) and save it to disk.
    $thumbnail1Field = "Thumbnail1_" . $i;
    move_uploaded_file($_FILES[$thumbnail1Field]["tmp_name"], 
        "images/th/" . $file_name);
}
?>

Edited by user Wednesday, November 5, 2008 9:54:10 AM(UTC)  | Reason: Not specified

Fedor  
#4 Posted : Wednesday, November 5, 2008 10:01:17 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
Quote:
Code:
    $sourceFileField = "SourceFile_" . $i;
    $mime_image = $_FILES[$sourceFileField]['type'];


You should not use this code with UploadSourceFile = false, as SourceFile_N does not exist. You can use Thumbnail1_N or Thumbnail2_N instead:

Quote:
Code:
switch ($mime_image){
...
}


If you upload thumbnails only without source image, then there is no need in this code, as thumbnails are always sent as JPEG images.

BTW, has original OptimizedUpload sample worked for you?

Edited by user Wednesday, November 5, 2008 10:18:29 AM(UTC)  | Reason: Not specified

Best regards,
Fedor Skvortsov
gargantouas  
#5 Posted : Wednesday, November 5, 2008 1:58:29 PM(UTC)
gargantouas

Rank: Newbie

Groups: Member
Joined: 11/4/2008(UTC)
Posts: 4

I think I have tried that allready but it didnt work...Now it does....lol..thank you very much.


Quote:
Code:
    $sourceFileField = "SourceFile_" . $i;
    $mime_image = $_FILES[$sourceFileField]['type'];


You should not use this code with UploadSourceFile = false, as SourceFile_N does not exist. You can use Thumbnail1_N or Thumbnail2_N instead:



Havent tried it will let you know...

Quote:
BTW, has original OptimizedUpload sample worked for you?

gargantouas  
#6 Posted : Wednesday, November 5, 2008 2:02:20 PM(UTC)
gargantouas

Rank: Newbie

Groups: Member
Joined: 11/4/2008(UTC)
Posts: 4

And another question in case Iwont find it searching the website...Can I add a select box underneath the edite description that I can submit with the form..? It is a select box that the user will select if the image contains resticted content....Thank you

Edited by user Wednesday, November 5, 2008 11:58:17 PM(UTC)  | Reason: Not specified

Fedor  
#7 Posted : Wednesday, November 5, 2008 11:58:41 PM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
Quote:
And another question in case Iwont find it searching the website...Can I add a select box underneath the edite description that I can submit with the form..? It is a select box that the user will select if the image contains resticted content....Thank you


There is no way to add select box for each thumbnail directly inside of Image Uploader. However you can either add one select box for all files (see Uploading Additional Data with Files) or use Multiple Descriptions Sample approach.
Best regards,
Fedor Skvortsov
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.