Cloudinary Change Public ID - cloudinary

I have been using Cloudinary to store images, and I want to change the public ID scheme I've been using. Is there any way to update the current public IDs to new ones using the admin API?
For example, if I have an image with a public ID of 1, can I change it to 2 without re-uploading the photo?

You can accomplish this by using the rename API.
For more information (in Rails):
http://cloudinary.com/documentation/rails_image_upload#rename_images

Related

How to make ProfileViews count in laravel?

I need help. How do I create profile visitors in Laravel 8? I have not written the code yet and I do not even have an idea how to complete this task. I would be very grateful if you could help me.
You can leave the visitor without any profile. He will be able to access public web pages without authentication and therefore only logged in users will have profile.
UPDATE
Proposed skeleton in two steps using cookies
1- When a user make request on profile page generate an unique identifier and store it in user cookie with a long enough validity if it not yet exists
2- Using this unique token register a new view count (if not yet done) before sending response to user.
use Illuminate\Support\Str;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use App\Http\Requests;
use App\Http\Controllers\Controller;
public function getProfilePage(Request $request){
if(!Cookie::has('uniqueId')){
$uniqueId = Str::uuid(); // generate unique id for current user
Cookie::queue('uniqueId', $uniqueId, [live time in minutes]);
// save it using Cookie::queue
// one year for example as live time
}
// check if view count already exists for $uniqueId
// and save it in a persistent way if not
// other stuff ....
return ....
}

how to display binary field data in website using a controller odoo 13

I was creating a controller to gets information from custom module and wonted to display the pdf or image on the website how to get the url.
I was able to download it using this
return http.send_file(maybefiel, filename='sdsdds', as_attachment=False)
but I wonted to display it can you please help
You can access a binary field using the following path:
your_url/web/content/model_name/id/field_name
For example, the field name of a user's profile picture is called "image", so, the URL looks like something like this:
http://localhost:8069/web/content/res.users/1/image
Where 1 is the user id.

Checking if a instagram image is private

Say I have the URL to an image, http://instagr.am/p/xxxxxxxx/, how can I check if the image is set to private or not from a webpage? Is there some API that I can use?
I need this since I have a bunch of Instagram images that I show on my page, but I want to remove the link to them if they become private.
I did not find a way to see if a specific image was private or not, so instead i save the AuthorID of the image. If this author has a private profile i will get an exception when trying to get the user information, and if i get an exception, then i know i can remove the link to the image.
This is my powershell-code i use:
try
{
Invoke-WebRequest "https://api.instagram.com/v1/users/<InsertAuthorID>/?client_id=xxxx";
}
catch [Exception]
{
# Remove Image
}
Use the GET relationship endpoint.
https://api.instagram.com/v1/users/user-id/relationship
This endpoint returns a BOOL value "target_user_is_private".

Combining DataSource and Local Data in SmartGWT ListGrid

I have extended a ListGrid to create a list of saved searches grouped by type of search, whether public or private. This list is populated through a standard SmartGWT datasource.
In addition, I would like to add to this list a grouping of historical searches, that would be available to a user as they create searches on a session-by-session basis (IE. a user creates a new search - until they close the browser, that search will display in the search list, under the grouping 'Historical Searches').
Long story short, I would like to be able to populate the ListGrid from two separate sources - from the already existing datasource and ideally from a RecordList saved in memory. I tried something similar to this:
#Override
public void fetchData() {
invalidateCache();
discardAllEdits();
super.fetchData();
setCanEdit(true);
for(Record r : histSearches.toArray()) {
startEditingNew(r);
endEditing();
}
setCanEdit(false);
markForRedraw();
};
While this code does get executed, it does not in any way perform the functionality that I'm hoping for it to do. Does anybody have any suggestions on how to perform this functionality? Any help would be greatly appreciated.
If you call DataSource.fetchData(), in the callback you can get the selected data as a RecordList. You can then add your per-session searches via recordList.add(), and provide the modified RecordList to a ListGrid via setData().
By the way, there is also an article on the public wiki showing a sample implementation of saved search (though different from what you want):
http://wiki.smartclient.com/display/Main/Saved+Search+%28Smart+GWT%29

Get the current user Liferay using a simple Java code

I'm working with : Liferay 6.0.6 with JBoss 5.1 and Struts2.
My question is, how to get the current user in Liferay once logged in, using a Java code.
In your doView/processAction method do following
User user = (User) request.getAttribute(WebKeys.USER);
or use the ThemeDisplay object. It contains another information like companyId, groupId, ...
ThemeDisplay td =(ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);
User user = td.getUser();
Classes ThemeDisplay, User nad WebKeys are part of portal-service.jar.
If you need just some id to identify current user you can also use
String userId = request.getRemoteUser();
This solution is not Liferay specific and should be portable among jsr-286 portals.
Liferay provides Util class
com.liferay.portal.util.PortalUtil
This class contains all utility methods to get the frequently used attributes.
Try using PortalUtil.getUser(PortletRequest portletRequest) method to avoid creating new objects and references.
This is an other possible way to do it :
private LiferayFacesContext liferayFacesContext = LiferayFacesContext.getInstance();
User currentUser=liferayFacesContext.getUser()