Hello,
I'm still working on a solution for the previews ticket (https://toolset.com/forums/topic/modify-the-image-orientation-in-cred-frontend-form/)
I have found some librairies that could be used to rotate the image, but now, I need to bypass the standard WordPress image loader used in Cred.
Could you tell me if there is a potential hook to use for this, or if not, where is located (which file) the current function in the Cred / WordPress area.
Regards
Pat
I need to bypass the standard WordPress image loader used in Cred
I'm not sure I understand exactly what you mean by "bypass". If you do not want to use CRED to upload an image in a new post, remove the image field from your form and replace it with whatever custom image uploader you want to use. Then add custom code to insert the image into the post using update_post_meta and the cred_save_data hook:
add_action('cred_save_data', 'cred_save_custom_upload_image',10,2);
function cred_save_custom_upload_image($post_id, $form_data) {
if ($form_data['id'] == 1234)
{
$image_url = 'some url here';
update_post_meta($post_id, 'wpcf-slug', $image_url );
}
}
You'll have to figure out the "some url here" part based on how your custom image uploader saves the image URL.
Hi Christian and sorry not bring clear.
In fact, I want to keep using Cred for uploading an image field but (still) need to offer image rotation in the front end. We have several discussions with the Toolset team and it seems this is something that is in the todo list, but nobody is able to give me a potential availability date.
As my client is waiting for this feature for a quite long time now, I need to find a workaround and here is how I see the process :
Cred uses the standard WordPress image loader
I have some jquery librairies to make the image rotation
So, I would like to know how I could insert these librairies into the standard WordPress image uploader process in order to add the rotation feature in the front end.
Hope this is clear?
Regards
Pat
It's clear, thanks, but it's not something we will be able to assist you with here in the forums. This is custom code that extends the functionality of Toolset, and therefore falls outside the scope of the support we provide here. Please refer to our support policy for more information about what we are able to provide here. I can help you use any of the documented CRED API hooks to achieve your goals, but there is no simple hook for CRED to add a jQuery image rotation library or insert a custom jQuery action during some specific step in the forum submission. Hopefully the new Media Uploader interface feature will be ready soon for your client, but until then a custom code solution would be required.
Hi Christian,
I can understand this, but you need to know that I have made some request to Toolset consultants and none of them have been able to bring us a solution for this issue !
What is difficult in terms of commercial link with our client is that we are not able to give him a clear status of the potential availability date for this feature coming from Toolset !
A good idea of this availability date would help to clear big part of this issue !!!
Regards
Pat
Supporters don't have knowledge about when specific features are going to be released until just before the release, in general. If a beta version for a plugin becomes available we will receive that information along with a list of features to be added or fixed, but typically we receive that information within a week of the beta being available. I haven't seen any information about this feature in our company blog, and typically features like this will be discussed before we release. I don't see any beta versions available now, so the best answer I can provide is that the release of this feature is not likely within the next couple of weeks. Beyond that, unfortunately I have not received any more specific information.
Hi Christian,
I understand your point. The issue for me is that I cannot have any a good view of the time needed to integrate this function into Cred !!!
Now, I have another way to manage this :
I can find some jquery librairies able to manage the image upload (including rotation and crop)
So, instead of using the normal Cred shortcode, I should be able to use an HTML code and use the dedicated librairy.
What do I need to plan in order to ensure that the uploaded image will be stored with all needed parameters (the parameters that would have been generated by the standard Cred image upload process)
Regards
Pat
CRED would normally insert the image into the Media Library, and save the URL of that image as the value of the related custom field. I assume the loader you are using will insert the image in the Media Library as well. You'll need to handle the second part yourself - save the URL of that image as the value of the related custom field. You can do this with the WordPress function update_post_meta or update_user_meta, depending on whether the CRED form creates posts or users.
Hi Christian,
Would it be possible to insert the html image form into the Cred form in order to be able to make everything in the same action (this would also help to use the cred_save_data to record the right link to the image).
Regards
Pat
Would it be possible to insert the html image form into the Cred form
Hi Pat, nested forms are not allowed in HTML, so I think you may run into problems here and I don't recommend it. You might be able to place your custom image form on the same page, but outside the CRED form. Then use custom JavaScript to transfer values between your forms. I think this would be a better approach than trying to nest forms.
Hi Christian,
I'm coming back on this topic.
I have found a freelancer that have been able to make the function. For this, he has modified some of the Cred plugin files.
This is something I have paid, but I would be happy to share with Toolset if you can integrate it easily in your Cred plugin.
Let me know and I will forward you the modified files.
Regards
Pat
I will be happy to pass along any files you would like to share! I will activate private reply fields here so you can share a download link in confidence.