I am developing a little project for school where I have to get some information from this db: https://api.themoviedb.org/3/movie/popular?api_key=a4571caf3b2611c1effc82a2c8323b15&language=en-US&page=1
I would like to get the image thats in ["poster_path"] and put it into a tableView.
For other images I did this: cell.imageView?.image = UIImage.init(named: llibre.img)
but for a path, it doesn't work. I have already connected the bd to the project.
path example: "poster_path":"/jjPJ4s3DWZZvI4vw8Xfi4Vqa1Q8.jpg"
I have tried to replace "name" for path, and other silly things that doesn't work.
cell.imageView?.image = UIImage.init(path: \/jjPJ4s3DWZZvI4vw8Xfi4Vqa1Q8.jpg)
Any help would be very useful. Sorry for my english, it's not my native language.
Thank you
Based on Tmdb Document
You can concatenation the return value from api with this value
http://image.tmdb.org/t/p/w185/
result example : http://image.tmdb.org/t/p/w185//xmgAsda5sPNpx5ghJibJ80S7Pfx.jpg
This is value w185 for image size
Related
My application is trying to insert a bunch of images to google drive sheet using google app script.
The script method is calling from a Rails app as following:
#app_script.run_script(script_id, request)
The script method is trying to fetch the image through the id and insert it to the sheet.
var srcfile = DriveApp.getFileById(object.image_file_id);
srcfile.setSharing(DriveApp.Access.ANYONE_WITH_LINK, DriveApp.Permission.VIEW);
var image = SpreadsheetApp.openById(object.spreadsheet_id).getSheetByName(object.sheet_name).insertImage(Drive.Files.get(srcfile.getId()).webContentLink, object.column, object.row);
The problem is coming intermittently with the response error from google script:
Exception: Error retrieving image from URL or bad URL: https://drive.google.com/uc?id=1yZULGInEcjQ_nA4j_Nmy6F2e3JcYnLFP&export=download
Note that I can download the image successful if I just copy the link and paste it to browser.
The image file and its parent folder are public share.
It seem hard to detect the problem when it does not always happen.
For those who concern about my script, it is here
Exception: Error retrieving image from URL or bad URL
This is a common error message when the image size is too big.
See here for more information.
You need to recuce the image size - either manually or programmatically - before inserting.
UPDATE
If the suggestion above does not solve your issue, implement the following workaround:
Instead of inserting the image by its webContentLink with the method insertImage(url, column, row) , use the method insertImage(blobSource, column, row):
var image = SpreadsheetApp.SpreadsheetApp.openById(object.spreadsheet_id).getSheetByName(object.sheet_name).insertImage(DriveApp.getFileById(srcfile.getId()).getBlob(), object.column, object.row);
This should solve the issue.
Let me try to explain my issue.
I've an image in my Drive URL = "https://drive.google.com/open?id=0B7Qr0kRr6yOOLXB1OE5lUUxBRjQ"
I converted it to "https://drive.google.com/uc?export=download&id=0B7Qr0kRr6yOOLXB1OE5lUUxBRjQ"
Replaced "open?id" with "uc?export=download&id"
I've modified URL of step 2 above in Sheet1!A1
At Sheet1!A5 When I use =Image(A1,1) it doesn't works.
but when I use =Image("https://drive.google.com/uc?export=download&id=0B7Qr0kRr6yOOLXB1OE5lUUxBRjQ",2) it works. This shows up image.
Q: What's the reason that when i use direct URL with Image Function it works but when i give cell reference of containing URL it won't.
Please help to find the issue! Thanks in advance.
use =Image(&A1,1)
this means "&" puts the value of A1 in the image formula and displays the image.
I am doing a newsmigration to latest Contao 4.
Can anyone please explain how the image files are related to tl_news table ?
Currently for my migration I have imagepath and imagename for the respective image.
When I add an image to a news in contao through backend. The following fields get updated in database.
addImage => 1,
singleSRC => f52a3871946211e782662e3e7a222c66
But when I search singleSRC in tl_files.uuid , it doesn't show any records.
Please help me to find how the images can be mapped during migration to Contao 4
The singleSRC field in tl_news (and also tl_content and tl_calendar_events for example) is a binary field containing an UUID that relates to the tl_files.uuid field.
I do not know how exactly you implemented your news migration script. But within the Contao framework, this is how you get the path to a file from singleSRC for example:
// $objNews is a \Contao\NewsModel object
$objFile = \Contao\FilesModel::findByUuid($objNews->singleSRC);
$strPath = $objFile->path;
And this is how you would add it back to the new news entry somewhere else:
// $strPath contains the relative path of the file on the other installation
$objFile = \Contao\Dbafs::addResource($strPath);
$objNews->singleSRC = $objFile->uuid;
EDIT :
I've been able to resolve this, after finding that iOS uploads every image as "image.jpg". In freeASPUpload.asp, I changed the following :
For Each fileItem In UploadedFiles.Items
filePath = path & fileItem.FileName
Set streamFile = Server.CreateObject("ADODB.Stream")
streamFile.Type = adTypeBinary
streamFile.Open
StreamRequest.Position=fileItem.Start
StreamRequest.CopyTo streamFile, fileItem.Length
streamFile.SaveToFile path & FileName, adSaveCreateOverWrite
streamFile.close
Set streamFile = Nothing
fileItem.Path = filePath
Next
To :
For Each fileItem In UploadedFiles.Items
FileName = GetFileName(path, fileItem.FileName)
fileItem.FileName = FileName
filePath = path & fileItem.FileName
Set streamFile = Server.CreateObject("ADODB.Stream")
streamFile.Type = adTypeBinary
streamFile.Open
StreamRequest.Position=fileItem.Start
StreamRequest.CopyTo streamFile, fileItem.Length
streamFile.SaveToFile path & FileName, adSaveCreateOverWrite
streamFile.close
Set streamFile = Nothing
fileItem.Path = filePath
Next
This is within the save function of the script. The GetFileName function iterates over what is in the folder already, and adds a number until it is unique. It then updates the file key to its new name. I've left an "image.jpg" file in the temp folder, so that it always finds one. That works for now.
What I've found, however, is for some reason, it flips the second photo out of the five that the form allows for..
I will try to fix that / look for others with the same issue. I've always had problems with iPhones and iPads rotating pictures, and it's never consistent.
I'm trying to grab multiple files from a mobile fleet of iPads and iPhones. Currently I have 5
<input type="file" name="fileX" accept="image/*">
This works fine in a browser (using free asp upload / classic ASP). In testing, it works with IOS, but only if I send one file. If I send more then one via the form, I get the error 'file not found'. It seems like the files aren't being sent at all.
The file not found kicks back when trying to manipulate the file via FSO.
Uploads here :
Dim Upload, fileName, fileSize, ks, i, fileKey
Set Upload = New FreeASPUpload
SaveFiles = ""
uploadsDirVar = "directory"
Upload.Save(uploadsDirVar)
ks = Upload.UploadedFiles.keys
Errors out here :
Set f=fs.GetFile(uploadsDirVar & "\" & Upload.UploadedFiles(fileKey).FileName)
Any ideas on how I can get around this? Everything I've read points towards the HTML5 multiple tag on a single input. However, in my scenario, this won't work. I'm also tying descriptions for the images to the fields based on field name, restricting the upload to 5, re-sizing the images on the action page before passing it to its final destination and attaching them to an email.
Any advice welcome, and thank you for your time!
**Edit
The issue seems to be that IOS names all uploads "image", coming from either the camera or the library. Now the problem is how to rename the image before the script attempts to upload it. From what I'm understanding, it needs to happen within the asp upload component before it places the file.
See the above edit for the answer. As for the flipped images - turns out they are flipped straight from the iPad. I checked the exif data and I'm not sure how to account for this in my system. If I find the answer, I'll post here.
I'm trying to set the src of an img tag I have dynamically. The following piece of code works when running from eclipse but not after exporting it as a running jar file:
doc.getElementById("user-thumb").setAttribute("src", selectedVcard.getThumb().getFilePath());
The element got by the "user-thumb" id is an image. The thumb object returned is a simple custom ImageView I've extended to hold more information and is initialized using:
public Thumb(String url) {
super(url);
this.setFilePath(url);
getStyleClass().add("thumb");
}
the method getFilePath() is returning a path from a temporary file starting with:
file:/
But I've already tried to change it to
file://
and even:
file:///
and got no success. I have googled and searched here but every answer points to start with file://. Is there something wrong with my code or is it javafx 2? By the way, I'm using javafx 2.2 GA and the jre 1.7.0.6 from oracle. Cheers
You could use Data URI for the images
Something like ...
String imageMimeType = "image/jpeg"; // Replace this for the correct mime of the image
String dataURI = "data:" + imageMimeType + ";base64," +
javax.xml.bind.DatatypeConverter.printBase64Binary(imageByteArray);