Closed asadarshadar12 closed 5 years ago
Hi @asadarshadar12
Was the file uploaded successfully (can you see it in your Media Library)? Can you share the entire response and code you're using for the upload?
Hi,
Closing this issue due to the time elapsed. Please feel free to either re-open the issue, contact our support http://support.cloudinary.com or create a new ticket if you have any additional issues.
no i can't view that image in gallery. Sorry for the late response due to business in exams.
From: Maor Gariv notifications@github.com Sent: Tuesday, June 13, 2017 10:22:54 AM To: cloudinary/cloudinary_npm Cc: asadarshadar12; Mention Subject: Re: [cloudinary/cloudinary_npm] undefined image url u (#146)
Hi,
Closing this issue due to the time elapsed. Please feel free to either re-open the issue, contact our support http://support.cloudinary.com or create a new tickethttps://support.cloudinary.com/hc/en-us/requests/new if you have any additional issues.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/cloudinary/cloudinary_npm/issues/146#issuecomment-308009925, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ASdzRF8FrQWSZAppGy7H_0OxYwmRpXqNks5sDhyugaJpZM4ND95D.
Hi @asadarshadar12,
It seems like an upload issue. Can you share your upload code and the response you got so we'll be able to further investigate?
@MaorGariv here's my code and it's not working when i'm uploading photo from mobile
Controller
(function(window, angular, undefined)
{
angular.module('travel')
.controller('shareCtrl',['$scope','$state','$http',function($scope,$state,$http)
{
$scope.takePhoto=function()
{
navigator.camera.getPicture(camSuccess,camError)
}
function camSuccess(imageData)
{
var request= {
imageData:imageData,
name:$scope.name,
description: $scope.description
}
console.log('request Object is ', request);
$http.post('http://192.168.10.4:8080/mobileShare',request).then(function(response)
{
$state.go('view');
},function(error){
console.log('There is an error',error);
})
}
function camError(error)
{
console.log('there is an error', error);
}
}])
})(window,window.angular)
Server Side
module.exports.submitMobilePhoto= function(req,res)
{
var imageBuff= new Buffer(req.body.imageData, 'base64');
fs.writeFile('./tmp/picture.jpg',imageBuff,function(err){
if(err)
{
console.log('Error Found',err);
}
else
{
var fileName= process.env.GLOBAL_PATH+'/tmp/picture.jpg';
cloudinary.uploader.upload(fileName, function(response)
{
var picture=new Pic();
picture.name= req.body.name;
picture.description=req.body.description;
picture.url=response.secure_url;
console.log('Image secure_url is' + response.secure_url);
picture.save();
res.status(200).end();
console.log('This the response '+ res);
});
}
})
}
Hi @asadarshadar12,
Thanks for sharing the code. It looks correct and the upload should work. Can you also send the error message or the full response given?
Thanks.
I’m sharing the response i’m getting back on image upload when it goes to server. The screenshot belows show the logs
[cid:image001.jpg@01D303E5.FC555040]
Looking for quick and kind response 😊
From: Maor Garivmailto:notifications@github.com Sent: 23 July 2017 13:36 To: cloudinary/cloudinary_npmmailto:cloudinary_npm@noreply.github.com Cc: asadarshadar12mailto:asadarshad.ar@outlook.com; Mentionmailto:mention@noreply.github.com Subject: Re: [cloudinary/cloudinary_npm] undefined image url u (#146)
Hi @asadarshadar12https://github.com/asadarshadar12,
Thanks for sharing the code. It looks correct and the upload should work. Can you also send the error message or the full response given?
Thanks.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/cloudinary/cloudinary_npm/issues/146#issuecomment-317237928, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ASdzRJz2t9V959kuQzHGMC5fcxucnKYdks5sQwYVgaJpZM4ND95D.
Hi @asadarshadar12 ,
Didn't get the screenshot. Please share the full error trace and the X-Cld-Error
response header.
Thanks.
There’s no runtime or compile time error. The only problem is that i’m getting an empty url. Below are the logs
At Server Side
Image secure_url isundefined
This the response [object Object]
POST /mobileShare 200 1413.039 ms -
At Client Side
request Object is Object {imageData: "file:///storage/emulated/0/Android/data/com.framework.travel722831/cache/1500825670409.jpg", name: undefined, description: "Tgg"}
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10
From: Maor Garivmailto:notifications@github.com Sent: 24 July 2017 20:24 To: cloudinary/cloudinary_npmmailto:cloudinary_npm@noreply.github.com Cc: asadarshadar12mailto:asadarshad.ar@outlook.com; Mentionmailto:mention@noreply.github.com Subject: Re: [cloudinary/cloudinary_npm] undefined image url u (#146)
Hi @asadarshadar12https://github.com/asadarshadar12 ,
Didn't get the screenshot. Please share the full error trace and the X-Cld-Error response header.
Thanks.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/cloudinary/cloudinary_npm/issues/146#issuecomment-317458829, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ASdzRMKXbzPgTc62lowG5iEKuF6lNmXiks5sRLczgaJpZM4ND95D.
Hi @asadarshadar12,
The reason for getting an empty URL is probably due to an error (because the proper upload response is not present). Try to print the response from the upload to see the full error message.
Did you check out our sample projects? It can serve as a good reference when starting with Cloudinary - https://github.com/cloudinary/cloudinary_npm/tree/master/samples#photo-album-sample
I'm doing a mobile project not an web so I need some code sample that could came off for android device
From: Maor Gariv notifications@github.com Sent: Tuesday, July 25, 2017 6:50:37 PM To: cloudinary/cloudinary_npm Cc: asadarshadar12; Mention Subject: Re: [cloudinary/cloudinary_npm] undefined image url u (#146)
Hi @asadarshadar12https://github.com/asadarshadar12,
The reason for getting an empty URL is probably due to an error (because the proper upload response is not present). Try to print the response from the upload to see the full error message.
Did you check out our sample projects? It can serve as a good reference when starting with Cloudinary - https://github.com/cloudinary/cloudinary_npm/tree/master/samples#photo-album-sample
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/cloudinary/cloudinary_npm/issues/146#issuecomment-317743528, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ASdzRNo0u8C6UsIUUlaZTZtuzFjOPh8pks5sRfKtgaJpZM4ND95D.
Hi @asadarshadar12,
You can handle the upload from Android directly. Here is an example of wrapping the upload in an AsyncTask -
class UploadTask extends AsyncTask<String, String, Map<String, String>> {
private Exception exception;
protected Map<String, String> doInBackground(String... params) {
Map response = ObjectUtils.asMap();
try{
response = cloudinary.uploader().upload("<image>",
ObjectUtils.asMap("resource_type", "image",
"public_id", "somePublicId"));
}catch (IOException e){
System.out.println(e.getMessage());
}
return response;
}
protected void onPostExecute(Map<String, String> response) {
// TODO: handle the response
}
}
I'm using angularjs 1.6 please provide help material in that framework
From: Maor Gariv notifications@github.com Sent: Monday, July 31, 2017 1:11:22 PM To: cloudinary/cloudinary_npm Cc: asadarshadar12; Mention Subject: Re: [cloudinary/cloudinary_npm] undefined image url u (#146)
Hi @asadarshadar12https://github.com/asadarshadar12,
You can handle the upload from Android directly. Here is an example of wrapping the upload in an AsyncTask -
class UploadTask extends AsyncTask<String, String, Map<String, String>> {
private Exception exception;
protected Map<String, String> doInBackground(String... params) {
Map response = ObjectUtils.asMap();
try{
response = cloudinary.uploader().upload("<image>",
ObjectUtils.asMap("resource_type", "image",
"public_id", "somePublicId"));
}catch (IOException e){
System.out.println(e.getMessage());
}
return response;
}
protected void onPostExecute(Map<String, String> response) {
// TODO: handle the response
}
}
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/cloudinary/cloudinary_npm/issues/146#issuecomment-318998623, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ASdzRGSTegvZS5akO4ebr0IjIKvsJfVSks5sTYwqgaJpZM4ND95D.
Hi @asadarshadar12,
Please refer to our docs for several upload options in Angular (we have SDks for 1.X and 2) - http://cloudinary.com/documentation/angular_image_and_video_upload
Let me know if you have any further questions.
Closing this issue due to the time elapsed. Please feel free to either re-open the issue, contact our support at http://support.cloudinary.com or create a new ticket if you have any additional issues.
hi everyone i am a junior developer and i am working on a project to develop a medical app however my challenge is uploading an image to cloudinary firstly it returned 'UNDEFINED' and i have tried to look for the problem but all has been in vain.When i told to log the error to the error it now returns 'cannot read property 'UPLOADER OF UNDEFINED' any assistance is appreciated. Below is my group.controllers.js code trying to create a support group, using sequelize as my ORM;
const db = require("../models/index"); const cloudinary = require("../config/cloudinary"); const Groups = db.supportGroups;
// post a group exports.create = async (req, res) => { //console.log(req.body, req.file); try { const Group = await req.body.supportGroupName.toUpperCase(); const existGroup = await Groups.findOne({ where: { supportGroupName: Group }, }); await cloudinary.v2.uploader.upload( req.file.path, function (error, result) { if (error) { console.log(error); } console.log(result); } ); if (existGroup === null) { const newGroup = await Groups.create({ supportGroupName: Group, description: req.body.description, groupImageUrl: result.secure_url, imageId: result.public_id, }); return res.status(201).json(newGroup.supportGroupName); } else { res.status(409).json("Group already exists"); } } catch (err) { console.log(${err.message}); } };
Hi @Muneeza93 ,
Based on the error message you are getting, seems like importing Cloudinary SDK was not successful and the cloudinary object is not correctly defined.
Can you check if this is correct?
const cloudinary = require("../config/cloudinary");
How did you download Cloudinary NPM SDK? Please check the following doc for your reference on how to do the initial setup.
Hope that helps.
Regards, Erwin Lukas
thanks Leptians for reaching out; below is my cloudinary in the config.js which i thereafter require in my group.controllers.js;
const cloudinary = require("cloudinary").v2;
cloudinary.config({ cloud_name: process.env.CLOUD_NAME, api_key: process.env.CLOUDINARY_API_KEY, api_secret: process.env.CLOUDINARY_API_SECRET, }); module.exports = cloudinary;
thanks again Leptians, in my cloudinary.js file i was missing the CLOUDINARY_CLOUD_NAME so its now working. Much appreciated.
@Muneeza93 , ah! Thanks for the update. and I'm glad you figured it out :)
picture.url=response.secure_url
This picture.url is undefined. Means there is nothing being stored in thisI'm using
cloudinary.uploader.upload(fileName, function(response)