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

Notification

Icon
Error

Options
Go to last post Go to first unread
John Thelen  
#1 Posted : Tuesday, October 30, 2007 7:26:30 AM(UTC)
John Thelen

Rank: Member

Groups: Member
Joined: 11/15/2005(UTC)
Posts: 8

Hi,

We have an application that requires that the cropping width and height options be defined at the time the PhotoEditor is run. The current method for defining the crop dimensions through the EffectList.xml file works well when you want a consistent list of cropping sizes. Our application needs to have the size predefined based on the destination of the image within our application.

Can you provide any insight as to how this can be done?

Thanks!
John
John Thelen
Sergey Peshekhonov  
#2 Posted : Tuesday, October 30, 2007 2:08:31 PM(UTC)
Sergey Peshekhonov

Rank: Advanced Member

Groups: Member
Joined: 6/5/2007(UTC)
Posts: 57

Hello, John

Unfortunately PhotoEditor 2.0 doesn't allow to change list of crop proportions dynamically.
Could you describe your requirement in more details in examples of usage? We highly appreciate feedback which helps us to focus our products to solve customers' tasks and requirements.

Thanks in advance.
Sincerely yours,
Sergey Peshekhonov.

Aurigma Technical Support Team.
John Thelen  
#3 Posted : Wednesday, October 31, 2007 12:03:50 AM(UTC)
John Thelen

Rank: Member

Groups: Member
Joined: 11/15/2005(UTC)
Posts: 8

Our application supports the real-estate market here in the states. Realtors go on-line to build listing fliers, post cards, and so forth.

Each product allows the realtor to upload photos of the property they are selling. Each photo has very specific dimensions that need to be pre-set in the photo editor so that when they crop the image, it's sized properly.

We currently use version 1 of the photoeditor and it allows us to define the ratio of the "rubberband" (crop box). We were hoping that this functionality was still in place.

How about this. Is there a way to define (override) the name of the EffectsList.xml file at run time? Right now its defined in the config.sys. I could dynamically generate the EffectsList.xml file at run time with the correct dimensions based on the product the user is building.

Let me know your thoughts.

Thanks!
John Thelen
John Thelen  
#4 Posted : Wednesday, October 31, 2007 1:09:46 AM(UTC)
John Thelen

Rank: Member

Groups: Member
Joined: 11/15/2005(UTC)
Posts: 8

Hi Sergey,

If there is no way to dynamically define the XML file name at run time, then would there be a way for me to get a copy of the source code for the crop-demo shown on your demo page (http://www.aurigma.com/Products/GraphicsMilldotNET/OnlineDemo.aspx)?

I'm specifically looking for a way to automatically determine if the resulting resolution is too low and notify the user -- like the demo does with the red message.

Thanks again!
John
John Thelen
Sergey Peshekhonov  
#5 Posted : Wednesday, October 31, 2007 7:29:04 PM(UTC)
Sergey Peshekhonov

Rank: Advanced Member

Groups: Member
Joined: 6/5/2007(UTC)
Posts: 57

Hello, John

We will surely discuss the idea of changing EffectList.xml at runtime. But now it seems that it needs a lot of changes in the PhotoEditor. As for your request - I made some workaround for you. It allows to change parameters of the Crop effect at runtime. You can use the following sample to solve this problem. I just added function named FindControlRecursive to Default.aspx.cs and made some changes in Render function of the same file.

Here is the code you should add to your Default.aspx.cs:
Code:

	// Here we try to find CropEffect control into the Page.
	private Control FindControlRecursive(Control root)
	{
		if (root is Aurigma.PhotoEditor.Effects.CropEffect)
			return root;
		for (int i = 0; i < root.Controls.Count; i++)
		{
			Control cl = null;
			cl = FindControlRecursive(root.Controls[i]);
			if (cl != null)
				return cl;
		}
		return null;
	}

	protected override void Render(HtmlTextWriter writer)
	{
		// For example the type of property can be passed through 'get' query string
		// .../Default.aspx?type=card
		string type = Page.Request.Params["type"];
		// If we have some type in get request string we should save it to ViewState.
		// This will allow us use PostBacks and not forget about current type of the property.
		if (!String.IsNullOrEmpty(type))
		{
			this.ViewState["type"] = type;
		}
		string tp = (this.ViewState["type"] != null) ? this.ViewState["type"].ToString() : null;
		if ((!String.IsNullOrEmpty(tp)))
		{
			// Find CropEffect.
			// We make search in Render(...) function because control of the effect was 
			// added to the controls tree during OnPreRender stage.
			Control cl = FindControlRecursive(PhotoEditorSample1);
			if (cl != null)
			{
				Aurigma.PhotoEditor.Effects.CropEffect ce = (Aurigma.PhotoEditor.Effects.CropEffect)cl;
				// Here we just replace formats string of the Crop effect.
				if (tp == "photo")
				{
					ce.Params["formats"] = "4|6|true|Images/Effects/Crop/CropEffect4x6.png|4x6(photo)";
				}
				else if (tp == "card")
				{
					ce.Params["formats"] = "2|5|true|Images/Effects/Crop/CropEffect4x6.png|2x5(card)";
				}
			}
		}
		// Here we are happy.
		
		base.Render(writer);
	}

I hope that it will solve your problem. Feel free to contact us in case of any questions.

Edited by user Monday, December 17, 2007 9:48:50 AM(UTC)  | Reason: Not specified

Sincerely yours,
Sergey Peshekhonov.

Aurigma Technical Support Team.
John Thelen  
#6 Posted : Monday, November 5, 2007 12:52:50 AM(UTC)
John Thelen

Rank: Member

Groups: Member
Joined: 11/15/2005(UTC)
Posts: 8

Thanks Surgey!

I'll try this solution and let you know if I have questions and/or run into any problems.

John
John Thelen
John Thelen  
#7 Posted : Thursday, November 15, 2007 2:07:58 AM(UTC)
John Thelen

Rank: Member

Groups: Member
Joined: 11/15/2005(UTC)
Posts: 8

Hi Surgey,

I wanted to post a quick reply and let you know that the code you provided works like a charm. Thanks for your help!!!

John
John Thelen
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.