With carrierwave, I'd like to change the image without changing the location(filename). This way, all links to the old image will still work, but point to the new picture.
For example, I upload an image 'promotion1.png'. I link to this image in an editor. Afterwards, I have a new promotion (promotion2.png), and want to update the image without having to go to the editor again. So old filename points to the new file.
How can this be done? I don't want to be forced to use the same filename. I = an unwitting client :)
Related
I am working on blog like web project using lexical editor in nextjs.
I am trying to implement image plugin in lexical editor. For now it coverts to base64 format which will be expensive for storing in database. Instead of storing base64 I want to store the image link along with other text inside database. Also I am facing issue to implement image plugin of lexical editor in nextjs.
steps I want to follow
I want to upload image in aws s3 and then want to show in editor as image.
Another way I am trying to implement like a modal will open where image can be selected
and it uploads to aws s3 and gets image url, then want to show image url in editor.
Is there any solution for it?
Thanks in advance for any suggestion
I am tryin got upload a document/textView with images to my server...
Now I am trying to figure out what would be the best way:
1) You can add the images 1 by 1 to UITextView and lower the quality and upload the whole textView NSAtributedString as a NSData file or a .txt file, and then decode it when downloading.
2) While adding the images to the UITextView I upload them to the server and store a URL link to the images in the UITextView in the same place of the image, and before upload the text with the url's I convert that all to HTML and then display that in a UIWebView.
Now first option seems to be the easiest to setup, but not neccessarily the quickiest, as the final file you upload could be 2-10 mb with roughly 5-7 images with a basic quality....
Now the second option is done in app's like WordPress, and looking at they're code on github Github WordPress Keyboard they convert it differently to html using "libxml2" and store the url for the image when adding it....
And this option seems to be alot quicker I would of thought...
Now I think the second option would be the best, but I am pretty sure it can be done without using the amount of code wordpress use.
Is there a way of changing the url of an image when adding it as NSTextAttachment? Because when you convert NSAttributedText to html, the image just gets the local link to the file, and the name of the file is just "attachment"..
Now If anyone could give me some advice or better options that would be great!
Many thanks to anyone that spares some time to read this!
Create an image upload service which accept image and url as argument. Then you can generate those image url before sending them to image server and replace those local url with the generated image url.
Edit:
Maybe you can store the location of those images and remove them from the NSattributedstring first and replace with <img src = "url"> before converting it to "HTML".
But I would suggest you using one of those HTML Parser such as KANNA.
im new in ruby, here u can find my code: https://bitbucket.org/Messeir/reddit
I used carrierwave gem for uploading photos. Unfortunatelly i dont know how to show uploaded photo on main site near to submited links?
Here are a few thoughts.
The photo is uploaded. We're assuming that it'll land on the file system of your server somewhere.
After you receive the file upload, as a prototype, try to move the file in the Rails root "public/images" directory. On your page, you could try an image tag as such:
If that works, you can tell at least that your "file-upload-save-to-disk" operation is working.
In a second phase, save the file somewhere else, say in a /data/images directory. Create a controller that will respond to a /mycontroller/myimage?... url, an in that method, respond with the image content.
That's pretty rough but it's a start. Let me know how it goes.
Currently I am using rails_admin gem. Everything is connected, and everything is working as it should.
When I go to /admin, I pick a product for example, going Add new and then in new window I have option like image url (which supposed to take name of image for example test.png and that's it).
What is bothering me, I would like to somehow enable that when I fill all options, and enter image url, also add a browse option near it, so when user/admin clicks on Add Product at the bottom of the page, image is loaded (from that PC) and added into folder in assets directory I created assets/images/MyFolder.
I am uploading images to S3 storage using paperclip gem. It uploads successfully.
In my application, an user can change his profile photo. If user do the profile photo change, the new image will get uploaded successfully. The problem is the browser will show previous photo only after the upload. Only after a force refresh by the hitting ctrl + F5 will the new image display.
Note: image is uploaded using form post. I guess it's related with caching but I don't have clue where I can change my code. Please help me this out. Thanks.
What property of your image object are you using as the src of your image? If you use user.image.url (assuming that you have a User model and that the Paperclip field's called image) then the URL to the image on S3 should have a number in the querystring that acts to stop any caching so that you see the updated image immediately. For example the URL for the image should change from
http://s3.amazonaws.com/bucket/images/5/original/pic.gif?1250184309
to
http://s3.amazonaws.com/bucket/images/5/original/pic.gif?1250184348
which should stop the browser caching the image.