image

TCPDF and base64 image

夙愿已清 提交于 2021-02-11 15:24:57
问题 Good Afternoon, I have a problem with insert an image in a PDF document with TCPDF lib. The image is caught from JSignature in this manner: $uri=base64_decode($_POST['firma']); $filename=SIGNATURE_IMAGE_PATH.ucfirst(strtolower(($_POST['cognome']))).ucfirst(strtolower(($_POST['nome'])))."-".$birthday.".png"; $ret=file_put_contents($filename, $uri); In another PHP page I can view image correctly in this manner: <?php $string=base64_encode(file_get_contents(str_replace(" ", "", SIGNATURE_IMAGE

Display in view image loaded in controller with yii2

情到浓时终转凉″ 提交于 2021-02-11 15:22:52
问题 I'm trying to display in a view an image loaded in a controller (the image folder is not available directly from the view). I can correctly load the image in the controller but I did not find the correct way in order to provide the view with it. I tried to exploit the Yii::$app->response solution but it seems useful for the download of the image and not for showing it in the view page. Controller code (partial) public function actionView($id) { $imgFullPath = '/app/myfiles/img/65/img.jpg';

User draw shapes on top of an image

不想你离开。 提交于 2021-02-11 15:13:51
问题 I would want to allow user to draw semi-transparent basic shapes (rectangle, circle) with user defined text over an image. The basic idea is to have a map underneath and users could mark certain areas of from it. It has been a while since doing web development and I'm quite uncertain which approach would be the best. It should work even on older browsers. Any help would be appreciated! 回答1: First, forget about old browsers, it's 2012 after all. You won't be able to draw circle without having

Can't load javaFX Image

我只是一个虾纸丫 提交于 2021-02-11 15:11:08
问题 I'm having some troubles to load images in javaFX from the controller. I put some images in the src/ folder and even in a folder img/ but still getting "Invalid URL or resource not found". My directory is like src/ package/ javaFXcontroller.java img/ image.png So I'm doing Image img = new Image("./img/image.png"); But I can't retrieve the image "java.lang.IllegalArgumentException: Invalid URL or resource not found" Thanks for your help 回答1: For those who may encounter the same problem, just

Can't load javaFX Image

左心房为你撑大大i 提交于 2021-02-11 15:07:37
问题 I'm having some troubles to load images in javaFX from the controller. I put some images in the src/ folder and even in a folder img/ but still getting "Invalid URL or resource not found". My directory is like src/ package/ javaFXcontroller.java img/ image.png So I'm doing Image img = new Image("./img/image.png"); But I can't retrieve the image "java.lang.IllegalArgumentException: Invalid URL or resource not found" Thanks for your help 回答1: For those who may encounter the same problem, just

why the image doesn't save on my code and just saved by admin page?

£可爱£侵袭症+ 提交于 2021-02-11 14:56:30
问题 I need to know why the images don't save in the path. I checked from the path and both of static root and media root seems to work good but the image doesn't save, here is the code where you can see what's happening: notice : the image works fine and has installed by admin page but doesn't save or work by my code. models.py class Product(models.Model): ... image = models.ImageField(upload_to='img/', blank=True) def save(self, *args, **kwargs): if not self.image: self.image = 'empty.jpg' super

Cannot open .tif file due to 'cannot identify image file' error

一世执手 提交于 2021-02-11 14:56:26
问题 The file exists, path is correct, however I cannot load the .tif file. Please send help? Here's the code .. import os from PIL import Image name = 'PE-0D8-4m-10s-0001_00009_bbo.tif' THIS_FOLDER = os.path.dirname(os.path.abspath(__file__)) filename = os.path.join(THIS_FOLDER, name) image = Image.open(filename) And here's the traceback: Traceback (most recent call last): File "C:\Users\owner\MATLAB Drive\Python\imageload.py", line 23, in <module> image = Image.open(filename) File "C:\Users

How can I export the stamp annotation from image to an image file?

痴心易碎 提交于 2021-02-11 14:49:27
问题 How can I export the “stamp annotation from image” to an image file? I have a pdf which contains stamp annotions (in fact it's an image), I want to export all these kinds of images to file and get the x/y position. I am new to pdf. Any idea or code will be appreciated. [--- Edited on 2019/08/08 ---] private void btnExtractAnnotaion_Click(object sender, EventArgs e) { PdfReader reader = new PdfReader(this.txtPdf.Text); PdfDictionary pageDict = reader.GetPageN(reader.NumberOfPages); PdfArray

KeyError: ((1, 1, 1280), '|u1') while using PIL's Image.fromarray - PIL

為{幸葍}努か 提交于 2021-02-11 14:34:57
问题 I have this code: from PIL import Image import numpy as np img = Image.open('img.jpg') Image.fromarray(np.array([[np.mean(i, axis=1).astype(int).tolist()]*len(i) for i in np.array(img).tolist()]).astype('uint8')).show() And I am trying to modify the pixels of the image in PIL, however when I run it it gives an error as follows: KeyError: ((1, 1, 1280), '|u1') Not just that, it also outputs a second error as follows: TypeError: Cannot handle this data type Is there a way to overcome this? P.S.

Fabric JS 2.4.1 How to use clipPath to crop image that has been scaled smaller or larger then 1:1 Ratio

橙三吉。 提交于 2021-02-11 14:27:51
问题 I have been trying to figure out what I am doing wrong when calculation the position and size of the mask rectangle once the target image has been resized. Below is the documentation from fabric JS: clipPath :fabric.Object a fabricObject that, without stroke define a clipping area with their shape. filled in black the clipPath object gets used when the object has rendered, and the context is placed in the center of the object cacheCanvas. If you want 0,0 of a clipPath to align with an object