使用 PHP 重新创建类似于 VistaPrint / CafePress / Zazzle 的东西。有什么想法吗?
我正在开发一个网站,客户希望用户将背景图像上传到可打印的设计,裁剪到尺寸,添加文本。对多个页面执行此操作,然后生成“书”的 pdf
我遇到了以下问题,只需要看看我可以从哪里开始
是否有任何 PHP 开发人员包可以执行类似的操作。我见过 jquery 裁剪工具,但也见过一些用于向图像添加文本的工具?
我如何保持决议?如果最终裁剪的文本图像需要为 150dpi,在裁剪时我猜我会让它们处理 72dpi 图像,然后以某种方式应用裁剪并更改到大图像?
如果分辨率问题不是什么大问题,我会这样解决:
- 简单的图像上传
- 使用 jquery 裁剪照片以更正尺寸
- 使用 gdlibrary 和 imagettftext() 将文本放到图像(页面)上
- 使用类似的东西FPDF 从每个“页面”创建一个 pdf
这是正确的方法吗?以及对解决问题的任何想法。感谢您的帮助!
I am working on a website in which the client wishes to have users upload background images to a printable design, crop to size, add text. Do this to multiple pages then generate a pdf of the 'book'
I am running into the following issues/questions and just need to see where I can start
Are there any PHP developer packages that can do something similar. I have seen jquery crop tools but something also for adding text to an image?
How would I keep the resolution up? If the final cropped with text image needs to be 150dpi, when cropping I am guessing I would have them working on a 72dpi image, then somehow apply the crop and changes to the large image?
If the resolution issue wasn't a big deal I would go about it this way:
- Simple image upload
- Use jquery to crop photo to correct dimensions
- Mess around with gdlibrary and imagettftext() to get the text onto an image (page)
- Use something like FPDF to create a pdf from each 'page'
Is this the right way to go about it and any thoughts on the resolution issue. Thank you for any help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的主要工具应该是 ImageMagick。 ImageMagick 可以进行裁剪、调整大小、缩放、覆盖文本或图形、组合图像以及应用特殊效果。使用单独的工具而不是 PHP 的图像处理工具的一大优点是,您可以通过其他机制批量执行相同的转换,甚至将工作移交给另一台服务器以保持网站的响应速度更快。如果您确实想将其紧密集成到网站中,则可以使用 MagickWand For PHP 界面。
裁剪不会改变 DPI,只会改变图像的尺寸。另一方面,规模化改变了两者。
您应该看看 Gallery,这是一个 GPL 程序,其中包含您正在寻找的一些功能,并且用 PHP 编写。
Your primary tool should be ImageMagick. ImageMagick can do the cropping, resizing, scaling, overlay text or graphics, combining images, and apply special effects. A big advantage of using a separate tool instead of PHP's image manipulation tools is that you can do the same transforms in batch through other mechanisms, or even hand the work over to another server to keep the website more responsive. And if you do want to integrate it tightly into the website, you can use the MagickWand For PHP interface.
Cropping does not change DPI, only the dimensions of the image. Scaling, on the other hand, changed both.
You should take a look at Gallery, a GPLed program with some of the functionality you're looking for, and written in PHP.
domPDF 是将 HTML 转换为 PDF 的好工具。这样您就可以使用他们上传的图像作为背景图像,然后将文本放在任何标准 HTML 标记中。
就分辨率/dpi 问题而言,我不确定除了更改图像大小之外是否还有很多可以做的事情。我建议您查看 这个 PHP 库,它有很多很好的工具用于操作图像。
我认为通过这些工具的组合,您将能够创建 HTML,从而生成适合打印的 PDF,并使用它。
domPDF is a good tool for converting HTML to a PDF. this way you can use the image they upload as a background image, then put the text over it in any standard HTML tag.
As far as the resolution/dpi issue goes, I'm not sure if there is much you can do outside of changing the size of the image. I would recommend looking into This PHP Library, which has a lot of good tools for manipulating images.
I think with a combination of these tools, you'll be able to create HTML that can make a PDF that's fit to print, and use that.