Potrzebuję użyć tego w moim programie szyn, więc mogę uzyskać zawartość obrazu, a następnie base64 go. Wiem, jak to oprzeć 64, ale po prostu nie wiem, jak uzyskać obraz. Ktoś wie jak?Ruby file_get_contents equivalent
9
A
Odpowiedz
16
Edited by odzyskać z zewnętrznym adresem:
PHP:
$image = file_get_contents("http://www.example.com/file.png");
Ruby:
require 'net/http'
image = Net::HTTP.get_response(URI.parse("http://www.example.com/file.png")).body
+0
Awesome, jesteś niesamowita. Bardzo dziękuję VERRYYY. – deuces
1
HTTP/HTTPS/FTP można użyć modułu OpenURI:
require "open-uri"
image = open("http://www.example.com/file.png").read
Powiązane problemy
- 1. file_get_contents() Błąd
- 2. Python foreach equivalent
- 3. dispatch_after equivalent w NSOperationQueue
- 4. Angular 2 - ngShow equivalent?
- 5. Jquery input.files equivalent
- 6. Python #define equivalent
- 7. password_hash equivalent in nodejs
- 8. file_get_contents i kod php
- 9. File_get_contents nie działa?
- 10. urlencode i file_get_contents
- 11. PHP file_get_contents zwraca false
- 12. file_get_contents zwraca 403 zabronione
- 13. Wyjaśnij file_get_contents ('php: // input')
- 14. Python pdb (debugger) disp equivalent?
- 15. Rails "before_filter equivalent w Phoenix
- 16. Scikit-learn equivalent for C++?
- 17. Javascript toFixed equivalent in java
- 18. Visual Studio Code $ psise equivalent
- 19. C# DateTime.Ticks equivalent in Java
- 20. Equivalent urllib.parse.quote() w Pythonie 2.7
- 21. PHP file_get_contents z php nietkniętym?
- 22. PHP - Wysyłaj ciasteczko z file_get_contents
- 23. Czy file_get_contents używa pamięci podręcznej?
- 24. file_get_contents() Rozbija znaki UTF-8
- 25. Względne PHP Ścieżki dla file_get_contents
- 26. Solr PHP client vs file_get_contents?
- 27. Control + Break equivalent dla Mac w VBA
- 28. Jak zbudować AppCompatDialog z AlertDialog.Builder lub Equivalent?
- 29. Equivalent dnia tygodnia Funkcja VB6 w C#
- 30. contentize i contentOffset equivalent w widoku NSScroll
Mam na myśli ze strony internetowej. – deuces
Po uzyskaniu zawartości witryny można spróbować przeanalizować ją za pomocą wyrażeń regularnych. Możesz również zajrzeć do [nokogiri] (http://rubygems.org/gems/nokogiri) gem – ck3g