I have form type region, inside it I have three sub regions: one for image upload, second for uploaded images data view and third for uploaded images view. It's possible to upload image to database without page refresh and how I can make it? An idea is when user filling form, he can upload images and when he uploads images, list of uploaded images is updates (with dynamic action).
I have idea to create a dynamic action for page item "file browser" with change event, but how to upload an image to database without submit I don't know. Another problems is that I don't want refresh page, because user can loose filled data and data from form have to go to one table, but images to another.
Using the Dropzone plugin built for APEX is probably going to be your best option
https://github.com/Dani3lSun/apex-plugin-dropzone
This should be flexible enough to facilitate your non-submit needs, where it uploads into a collection after drag/drop, but before page submit.
Related
We have a problem when users update the og:image for an article.
The Open Graph Debugger picks up the new image, and our CMS triggers a scrape using the API endpoint documented here.
But for existing shares, Facebook renders a placeholder and doesn't update to the new og:image URL. Which means if the original image is deleted in our CMS, Facebook shows a blank placeholder:
Facebook's documentation says:
You can always edit an object's properties, with two exceptions:
Title: Once 50 actions (likes, shares and comments) have been associated with an object, you won't be able to update its title
Type: An object's type can't be changed once it's been used in a story
If you want to update an image for an object, we strongly suggest that the URL to the image be different than the original image URL. Caching may prevent the image from being updated.
Images uploaded to our CMS always have unique filenames, and are served from an Amazon S3 bucket via Cloudflare.
If we don't delete the original image from our server, in existing shares Facebook continues to use the original in spite of the og:image changing and us telling FB to re-scrape the URL.
How can we get the image to update?
Twitter and Linkedin do not have a problem as they appear to cache the original image on their servers, so once we delete the file they continue to serve the original og:image. That's fine - but Facebook needs to show an image.
Try ?v=2 at the end of og:image url.
I'm uploading an image file in a basic Django web app. There's an upload button in the html template wrapped around by a form tag. Once the upload button is pressed, the underlying view takes over and processes image upload.
In the Chrome browser of my colleague's Macbook, pressing upload multiple times really quickly manages to call the underlying function multiples times too. I end up getting a plethora of copies of the image being uploaded.
However, this isn't replicatable in my own environment's Firefox (Ubuntu OS). Seems this issue is browser sensitive?
In any case, how do I cut off this code behavior? If the user goes into a click frenzy, I don't want multiple images to go up. Can someone guide me how to handle this in Django? I would prefer a non-JS, server solution too.
Note: Let me know if you need to see my related code.
Many people faces this issue. If the submit button called 3 times wihtout waiting to refresh the browser, it will gonna add 3 times.To prevent that you can use jQuery.
For example on form submit you can show the loader or disable the submit button,
$('#login_form').submit(function() {
$('#gif').css('visibility', 'visible');
or
$('#button').prop('disabled', true);
});
Edit for server side implementation:
I do not suggest this for user interface point of view but if you can also valid submits using sessions or cookies.Generate random token in your view and set this in your form as hidden input.
for e.g.,
def checkform(request):
form = ExampleForm(request.POST or None)
randomtoken = #generate random token here and set in session or cookie
if form.is_valid():
# check_token here
session_value == request.POST.get('your_hidden_token')
# if matched than change the random token and save your data else do your restriction processing
render ( request,'template.html',context={ 'form':form,'randomstring':randomstring } )
I am developing a e-commerce project using django.It is a image based project where user can download image after subscription.
There is a single image download subscription package available to the user where user can only download an image for a single time.My home page have an image thumbnail.
If any user wants to download any image ,he can click on the selected image and then will take the user in the image detail page of the clicked image with download button option.If he subscribed,he can download the image.
Though its a single image download subscription,so user can only download a single image.but the problem is,after a single download,if the user don't leave the page,he is able to download the same image for an unlimited time.I want to restrict it but i have no idea how to do this in django.
After a single download,redirecting the user to the home page or my image thumbnail page can be solution,but i don't think it will be great idea.Because there will be a possibility to disconnection of internet or something right after the download event which will create situation where may be the user can not complete the download action.
so i want to settle the user in the image download page after a single download and immidietly wants to clear the session and restrict him to download the same image for unlimited time.
Can it be possible to clear the session after a single download,i think if i can clear the session after a single download or an event or whatever you say,then the user can not download the image for twice.Is it possible to clear the current session after an event in django?
Can someone please help me out as to how I can completely prevent the user's activity stream from posting back into their wall after they liked a linked? Because, I really find that to be annoying. Afterall, mine is an application that needs to be integrated into an image gallery viewer serving more than 7.5K photos each with its own like button.
If this seems impossible, is there a way to specifically set an image as thumbnail, description, etc as is with the cases of feed and send buttons?
Because, my application is purely dynamic in nature built out of 100% Javascript where more than 80% of its contents are generated by using Ajax calls under a static single URL.
As a result, the like button activity stream always end up pulling the wrong image and descriptions than desired(but this is not so for feed and send buttons),
Thank you
No, you won't have control over not sending items to peoples activity feeds when they click like, unless your domain gets blocked for spam. You would need to create a dynamic url or hashbang url for each independent image and when those images are requested the page hosting it would need to have the proper open graph meta tags sets for thumbnail image, description, etc. Then for each like button in the gallery, you would need to set the href property to this url.
Like the title suggested, I want to implement a two-steps picture uploading mechanism.
User selects a picture to upload and
click on "Upload". Once the server
receives the request that contains
the picture, it would save the
picture in a temporary location, on
disk or memory, and the resize it to
a standard size, if needed. The
server then renders a new response
for the user to preview the uploaded
picture.
After previewing the picture, the user needs to click on "Save" to confirm for the server. The server then moves the picture from the temporary location to a permanent one and updates the corresponding entry in the DB.
What's a good way to implement this? What are some of the apps out there that might be able to help me? Thanks.
I would suggest either rolling your own (you might find it surprisingly easy, start with reading the docs on forms) or customizing django-photologue or django-filebrowser.